I’ve started building a game where the character flies around with dragrigidbody script, I want to be able to click on gameobjects that are floating in the sky, which will then follow the player, then upon pressing right click it stops following the player (allowing them to pick up and drop off items in certain areas around the map). What coding could i use for this?
,How can I get a gameobject to follow my main character when clicked, then to stop following once I right click.
well, im kinda new to scripting myself but why not just use transform.position or lerp?
i use < and > as comments, do not write what are inside them. Also, i use C#.
grabbedobject.transform.localPosition = Vector3.Lerp( , , * Time.deltaTime);
heres what the finished one COULD be.
GrabbedObject.transform.localPosition = Vector3.Lerp( GrabbedObject.transform.localPosition, Hand.transform.position, MoveSpeed * Time.deltaTime);
hope i helped