#Object spinning around player on pick up

1 messages · Page 1 of 1 (latest)

restive shell
shut tide
#

as a Empty Game object

restive shell
#

Right, but what's the empty game object?

#

Is it your player? Or is it just some object in the world

shut tide
#

its a object attached to my player and its a bit infront of camera so tht when im holding it i can see it and its not all up in my face

restive shell
#

Ok, do this for me

shut tide
#

and i have TheDest connected to my camera so when i look up or down it also follows,cuz the thing im working on depends on alot of bugs to solve it,so i wanna use the bug of looking down and just repititly jumping up and up

shut tide
restive shell
#

In your game tab, turn on gizmos

shut tide
#

mhhm

restive shell
#

What kind of collider is your player? Capsule, right?

shut tide
#

yup

restive shell
#

Oh, wait this is important

#

your game is 3D, correct?

shut tide
#

yup

restive shell
#

Ok, good

#

In gizmos, search "capsule" and make sure its ticked

#

This will show the capsule collider of your player in game (and the scene view too I believe)

#

also make sure boxcollider is enabled (I assume your box is a boxcollider)

shut tide
#

yea idk why it wouldnt be

#

both r already on

restive shell
#

there are strange people here

shut tide
#

lol

restive shell
#

alright good

#

You have your IDE configured correctly, right?

#

should say assembly-csharp in the top left

#

(in VS)

shut tide
#

yup

restive shell
#

alright, attach VS to unity

shut tide
#

hehe wht is VS

restive shell
#

and we're gonna make a breakpoint in OnMouseUp()

restive shell
shut tide
#

ok

restive shell
shut tide
#

k

#

am i supposed to wait for something cuz i cant click OK

restive shell
#

Oh, you have your project in a dropbox folder

#

That will cause problems

#

Dropbox likes to try to 'sync' your project files which can can do some crazy stuff

shut tide
#

hm

restive shell
#

Shouldn't be related to this issue though

shut tide
#

k

#

i hope not

shut tide
#

im gonna

#

thr

restive shell
#

Alright, after you've done that, play the game and click to pick up

#

and the game should freeze once you let go of the mouse button

shut tide
#

kk

#

nope

#

still running fine

restive shell
#

Visual studio is attached to unity?

shut tide
restive shell
#

Are you clicking or going down the arrow

#

when you click on the arrow it should say these

shut tide
#

i was just clicking

#

not on the arrow

#

wht u want me to click once they all show up

#

attach and play?

restive shell
#

Try attaching again

#

without playing

shut tide
#

i never clicked tht but k

#

so u want me to click this or green arrow

#

cuz i tried both

restive shell
# shut tide

Preferences -> External Tools -> Make sure visual studio is selected

#

Your firewall might also be blocking Unity, which I don't really know how to help with

shut tide
restive shell
#

Sorry, Edit -> Preferences*

#

Missed a tab

shut tide
restive shell
#

thats visual scripting

#

maybe I got the tab wrong?

shut tide
#

¯_(ツ)_/¯

restive shell
#

no, it's edit -> preferences -> external tools

shut tide
restive shell
#

and thats the version of vs you're using?

shut tide
#

yup

restive shell
#

ok well if debugging isn't gonna work, we're just gonna do it the other way

shut tide
#

cuz i was modding for ktane and the latest version of the modkit is on tht version and i dont know how to switch but i dont feel like switching anyways

restive shell
#

Just start the game, click, and pause

shut tide
#

oookay

#

and?

restive shell
#

In your scene view, is your item's collider enabled and colliding with your player?

#

If so, you probably need to move your empty transform out further

shut tide
#

ok the empty game object thts wht ur talking about

#

it has no collider

#

and this is how far it is

restive shell
#

Does the box have a parent?

shut tide
#

ayup

restive shell
#

hold on

#
        this.transform.position = TheDest.position;
        this.transform.parent = GameObject.Find("destination").transform;
#

Is TheDest not the GameObject named "destination"?

#

If it is, whats the point GameObject.Find

shut tide
#

man idk

#

its thr cuz its thr

restive shell
#

So your problem is the item starts spinning while you're holding it?

shut tide
#

yup

restive shell
#

In which way

shut tide
#

around the player

#

so for a couple seconds i see it

#

and then its behind me

#

and comes back

restive shell
#

so it orbits you

shut tide
#

yup

#

and sometimes

#

it just floats away

#

slowly

#

i think ima just record

restive shell
#

how about you just set the item's rigidbody to kinematic

#

RigidBody.isKinematic = false

shut tide
#

idk wht tht does so idk whr to place it in the code

#

im gonna need u to tell me

restive shell
#

yeah the reason its doing that is because the item is hitting the colliders on the floors/walls

#

you have gravity disabled but that just makes it float (and it orbits around you because physics)

#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class box : MonoBehaviour
{
    [SerializeField]
    private Transform destination;

    [SerializeField]
    private BoxCollider boxCollider;

    [SerializeField]
    private Rigidbody rb;

    // Start is called before the first frame update
    void OnMouseDown ()
    {
        boxCollider.enabled = false;
        rb.useGravity = false;
        rb.freezeRotation = true;
        rb.isKinematic = true;

        transform.position = destination.position;
        transform.parent = destination.transform;
    }

    void OnMouseUp ()
    {
        transform.parent = null;

        boxCollider.enabled = true;
        rb.freezeRotation = false;
        rb.useGravity = true;
        rb.isKinematic = false;
    }
}
#

@shut tide

shut tide
#

hoi

#

lol\

#

k ima try it

#

it works

#

its just tht

#

one thing is now missing

#

which was the hole point of why i made this

#

to be able to hold it beneath u and then keep jumping on it and then fly up,cuz the hole game is based on solving by using bugs

restive shell
#

this one?

shut tide
#

yup

#

not like inspired more like bored and i saw it so i was like yea i bet i could do tht

#

and steal the entire idea

restive shell
#

stealing ideas is good for learning since you don't have to worry about coming up with original ideas and you can focus on just learning

shut tide
#

yea

#

especcially since like i am super un creative

restive shell
#

i mean thats kinda the whole point of bob ross

shut tide
#

lol

#

true

restive shell
#

but anyway, I'm not sure you're ready to do those kinds of physics things unless you have the specific code to do them

#

like, even I'm not sure exactly how he got the box floating in front of himself like that

shut tide
#

idk i just know it worked before

restive shell
#

well you disabled the collider

#

so thats probably one thing

shut tide
#

then i made a script so when u fall off the platform it teleports u bakc and then BOOM it broke

shut tide
restive shell
#

so just dont disable it

#

your player can't stand on it if it has no collider

shut tide
#

yea

#

well i did stand on it

#

but when i tried picking it up

#

i couldnt keep jumping

#

or it didnt go with me

#

when i jumped

#

up

#

and then it rotated

#

whtever i have a GREAT idea with the thing u did

restive shell
#

ok cool

#

im gonna close this thread now

#

since the problem is solved