Here is the thing.I have an empty gameObject and an object (a sphere). I would like to move into my 3D world and make my sphere move around my gameObject (we can’t see this game object). If I go in a direction (e.g right) I would like my sphere doesn’t follow immediately my gameObject but create a smoothly effect to join it. Do you have an idea how to make that in JS ?
I have this hierarchy :
So make orbits around dummy1 and smooth directions around dummy2.
why do you need 2 empty game objects (dummy 1 and 2) and not only one ?
Don’t see why the sphere is parented to the player group. I guess it shoud not.
what do you call sphere “move around” the player and “join” it ? Does the sphere stay at a certain distance from the camera or does it reallly join (get the exact same position) it ?
Basically it seem you need just :
player with “dummy 1” attached
camera “alone” with a script following “dummy 1”'s position.
But I may not understand your issue.
Screenshot of your scene could help, it’s not very clear…
Hum how to explain well …
So for me my sphere will move around my dummy1 (randomly) and when I’m navigating on the world I would like my sphere doesn’t follow exactly my position. For e.g I turn right and my sphere will follow my dummy2 but with a delay (so smooth effect).
For the moment I succeed on my random moves around dummy1. I hope I’m more clear
(for the screenshot I can’t for the moment I’m in my bed )
the behavior in your sphere just needs a few lines in an Update() function (which runs every single tick)
create a variable for your empty gameobject and plug in that gameobject in the inspector.
each frame, read the position of the gameobject by getting yourVariableName.transform.position
use:
to change your sphere’s position to gradually match your gameobject’s position.
I haven’t tried it, but I’m confident it’ll work. tell me if you’re confused or can’t figure it out and need more detail.