Rigidbody motion animation

Hello. In my game, a character holds a basket and catches items with it. The basket moves with animation, but in this case the rigidbody remains in place and does not move behind the basket. Tell me how to solve this problem.

Firstly, make sure the box shape (or whatever you use as a collider for basket) is kinematic. Secondly, make sure you set its position not on the player position, but on the basket node’s position.

If you named the basket’s bone in 3D modelling software as “basket”, you can search it as normal entity (if you haven’t added a bone, you should, otherwise there is nothing to attach the collider to).

var basket = playerEntity.findByName('basket');
var position = basket.getPosition();

Edit:
Depending on the type of model, you can get away without a bone, but adding a child entity to the player, that is used as a bone, which you attach the collder to. This can only work if you rotate in a single plane. If your basket moves in 3d, then you should add a bone to the model.

2 Likes

Indeed, I forgot to fulfill both points, thank you very much.

1 Like