Having objects following the Camera in a semi-realistic fashion

Hello!

I’m looking to find a way to have objects (say a person) follow a Camera object in a way that feels natural while using the Blockly blocks (if possible). The following objects needs to follow the player (as they change location).

So far, I’ve tried to use Physics objects and the Push (with set velocity) to make an object move. This is somewhat problematic since it doesn’t have consistent movement (the object just pushes itself in an inconsistent way). Additionally, the physics causes objects to fall over. I’ve tried to also restrict the physics movement of the object but that doesn’t seem to work. I’ve tried using the (Move Object x Meters in X seconds) which kind of works, but is somewhat unrealistic.

Additionally, I’m also looking for a solution where the object will follow the player/camera’s position at all times. Can the update block be used for this?

I’d love to hear if anyone has also tried this or if there are any solutions available.

Hello galileo-peter,

the easiest way to make one object follow another is to create parent-child relation between them.
There are two methods to create such relation.

First method is attaching. It creates a relation and adjust child’s position. This method is described here, but it is not applicable for camera object since camera doesn’t have any slot for attaching.

Second way is to make one object child of another without changing anyone’s position. Unfortunately at the moment it is possible only by executing build mode script. You should write simple script like this:

Scene.getItem("id_of_camera").add(Scene.getItem("id_of_child"));

After executing this code axe becomes child of camera:

image

Now by playing script axe always follows camera

2 Likes

Deprecated answer. Build mode not public available