Animating position with tweenjs disables collision detection

Hello everyone,

I am trying to animate a box with tweenjs and when animating the position using tweenjs the collision detection doesn’t work ? So my question is: Could it be possible that some thing on the background in tweenjs disables the collision detection?

Hi @zach_elsm! Collision should work normal using a tween. I guess there is another problem why collision doesn’t work.

If you have a dynamic rigidbody, it can only be moved with forces, torque and velocity. Every frame that the rigidbody is not asleep, it will update the position and rotation of the Entity.

Changing the position or rotation only affects the Entity, not the rigidbody. So while it looks like it is moving, the rigidbody is still in the same place.

If you are using tweening, then you should use a kinematic rigidbody instead where the rigidbody position and rotation is updated by the Entity position and rotation each frame.

You can switch between the dynamic and kinematic type at runtime too.

1 Like