Objects clipping during PoseAnimation

asked 2019-12-19 06:42:54 -0600

GonçaloLeão gravatar image

updated 2019-12-19 08:59:15 -0600

Good afternoon everyone, I'm working on a project where I need to make tube (composed of a set of cylinders) follow a predefined trajectory. The world and tube's parameters are the same as those in another question I asked. I'm trying to control the objects' movement using a World Plugin. I don't want any forces to alter the movement of the tube I'm moving, but I want it to apply forces to other tubes that are on top of it.

The trajectory is defined as an ordered set of positions that are relative to the tube's center of gravity. I intend on moving the whole model (all of the links) and only applying linear velocities (the angular velocity should be 0).

I have already experimented several alternatives, including:

  1. Using the PoseAnimation class (similar to the animated_box example). However, this causes the tube I'm moving to clip through the other tubes.
  2. Explicitly calling the SetWorldPose method on the model at each time step (via an "onUpdate" function passed to ConnectWorldUpdateBegin). However, the same clipping problem occurs.
  3. Explicitly calling the SetLinearVel method on the model at each time step. In this case, the clipping problem does not occur as the other tubes move along with the one I'm controlling. However, the tube I'm moving is still being subject to contact forces applied by the other tubes: if I read the model's linear velocity (with WorldLinearVel) before calling SetLinearVel, the velocity is slightly different from the one I'm explicitly setting (and the angular velocity is not null). If I call WorldLinearVel after SetLinearVel on the same call to onUpdate, the linear velocity is correct, which means that the physics engine (ODE) is also altering the model's velocities. I've already tried setting the model as static and using SetAutoDisable(true), but the problem persists.

I have also already tried reducing the physics engine's time step.

Ideally, I would like to control to tube's position directly (I'd prefer Alternative 1), rather than specifying its velocity, but any working alternative would be fine.

Do you have any suggestions?

Thank you for your time and help!

edit retag flag offensive close merge delete