Interaction around an gameObject

Hi everyone !

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.

Thanks ! :slight_smile:

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 :slight_smile:

(for the screenshot I can’t for the moment I’m in my bed :wink: )

no problem at all.

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.

For the moment I have this : http://www.unikapps.com/Bliss2.mov

I don’t know if it’s quite good but as you can see on the video my cube don’t stay at the screen when I move. I have to want it to join me …