dimforge / dimforge/rapier

Connect KinematicPositionBased and Dynamic bodies with a Joint so that they can be moved as one. There is a lack of synchronicity.

Open
#852 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
5.7k
Forks
387
Avg merge
4d 23h
Merged PRs (30d)
6

Description

Good afternoon.

There is a KinematicPositionBased body that can be moved using a KinematicCharacterController, and I want to attach an additional component to it using a Joint to properly move them as one.
Let's say there is a cylinder - it's a KinematicPositionBased (Character controller) and I want to attach a hammer to it. It's like an axis coming out of a cylinder, to which the hammer's head is attached through a lever. As planned, the player will be able to spin the hammer and hit the ball with it.

Avatar Composition:

* Avatar body (rigid body: KinematicPositionBased)
* Collider (Collider cylinder)
* Hammer (rigid body: Dynamic)
* Axle (Collider cylinder)
* Lever (Collider cube)
* Headband (Collider cylinder)
* Joint (Revolute on the X-axis. It can simply spin around the axis)

The problem occurs when translating the Avatar's Body (via .setNextKinematicTranslation). When the avatar moves, there is a noticeable delay in the movement of the hammer following the character. Depending on the direction of movement, either a gap appears or the body bumps into the hammer.

I would like to understand how it is possible to implement a rigid bundle so that the movements of the connected bodies are synchronous.

Image

Image

Image

demo (movement with WSAD keys):
https://l2l62c.csb.app/
sandbox:
https://codesandbox.io/p/sandbox/l2l62c

With respect,
Sergey

UPD:
Changed call from `setNextKinematicTranslation` to `setTranslation`. As result joint the connection has become stable.
But I'm worried that using `setNextKinematicTranslation` was recommended by the developers, and my hack may lead to unpredictable side effects in the future, in some cases.
demo: https://9d36n3.csb.app/
sandbox: https://codesandbox.io/p/sandbox/9d36n3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.