Object position resets when moved

So I move my Object into a new position with the manipulator and as soon as I let go the position resets to last position and I can’t move it. I have checked if the location is locked on the n panel. Help would be very much appreciated!

Hi

It is better to give an example of the code how this happens, if you move a physical object by means of Move, then for the “physical world” this is equivalent to teleportation and problems may arise.
In general, there is an example of Drag-and-Drop capabilities, maybe this will help:

I think it is not related to logic nodes, or the object position is “reseted” with some node you forgot in the tree.

In code you will need to do this sequence:

object.transform.loc.setFrom(location); // Set the location of the object
object.transform.buildMatrix(); // Build its matrix

objectRB.syncTransform(); // If the object have a rigid body you will need to sync its transform

To get the rigid body of the object:

var objectRB = object.getTrait(RigidBody);

Sorry I worked it out is was the rigid body! is there a way to move the object without removing the rigid body? Sorry for the late reply :frowning:

If you need to drag a physical object in order to preserve its properties, then either move it using impulses, forces, or create a connection (like pulling a rope)

You can move the object that has rigid body trough nodes: Test.blend (776.9 KB)

Use ‘W’ to move forward and ‘space’ to set its position.

If you are trying to do this trough code you must call "rb".syncTransform() right after changing its position or translating it.

If the object you are trying to move is a STATIC rigid body, you must enable the ‘Animated’ checkbox in its physics properties, so the “collision part of the object” will be also moved:

Captura de tela de 2020-12-04 07-37-45

But keep in mind that the physics of your game would be better if the character is moved trough the set linear velocity method

1 Like

@Callof_ZON is probably talking about the Blender editor, not about in-game movement. I often had this problem a while ago as well but I unfortunately can’t reproduce it now.

1 Like

@Callof_ZON, which version of Blender are you using? I had this problem in 2.90.
Let me remind you that for Armory to work correctly, you must use Blender 2.83. *.

Oh, indeed. Almost sure that the problem is the keyframe position:

@Callof_ZON, make sure to keep the keyframe in 1, or the Blender physics simulation will force the rigid body to be in the position of the next frame.
You can use the ‘right’ and ‘left’ arrows to change the keyframe one by one or hold ‘Shift’+‘respective arrow’ to snap to the start/end frame.

Here is one example, i leave the frame in 2, as a result you cant move the rigid body: untitled.blend (728.5 KB)

But just changing the frame back to 1 will solve this.

4 Likes