Application of RigidBodyControl transformations (moving platforms)

Hello everyone,

For my game, I created physical controller that can simulate moving platform, ascencor or object that turns on themselves.

I programmed my CustomCharacterControl class, I had problems with BetterCharacterControl, my characters were jumping all the time

When my character goes on a mobile platform, the velocity of the platform is not applied by default to my character,

To do this, during a captured collision, I add the velocity of my platform to moving my character via the setLinearVelocity method, so it moves along with the platform.

That works well.

@Override

public void collision(PhysicsCollisionEvent event) {

    if(event.getObjectA() == customCharacterControl){
       if(event.getObjectB() instanceof CustomBody){
           customCharacterControl.setFrictionTranform(((CustomBody) event.getObjectB()).getFrictionTranform().clone());
       }
       else
           customCharacterControl.setFrictionTranform(Transform.IDENTITY);
    }

    if(event.getObjectB() == customCharacterControl){
        if(event.getObjectA() instanceof CustomBody){
            customCharacterControl.setFrictionTranform(((CustomBody) event.getObjectA()).getFrictionTranform().clone());
        }
        else
            customCharacterControl.setFrictionTranform(Transform.IDENTITY);

    }
}

I would now like to be able to apply the same principle when the character rides on an object that turns on itself.

I thought, initially, pass the rotation of the platform and apply it to my character but it does not work.

I also thought, at the time of contact, attached a node to the platform. the transformations of the platform will therefore be applied to the child node.

But how to then apply the transformations of the node to RigidBodyControl ? and most importantly, if I put my Custom RigidBodyControl in Kinematic, it will no longer be influenced by physics.

What do you recommend to me as a solution ?

Here is a small video of the problem:

Thanks

The “physics” way would be to pick two points of collision (like the feet for example but any two points should do) and apply the island’s current torque at those points to the object as two separate forces.

I don’t know how easy/hard that is to do.

Even with your simple approach, why isn’t setting the rotational velocity enough? Set the linear velocity based on the torque at the contact point. Set the rotational velocity to be the same as the island.

Most games simply make two physics spaces for on-the-train and off-the-train. Then you have to round off the edges of the transition. Theres many funny videos where that goes wrong in AAA engines, like a guy hanging on the car making the car have a bulge in it’s “real world” physics space etc.

For a simple platform you should simply by able to put a physics object on it and it will move along but that won’t work when you modify the velocity directly (as its the only result of the physics). So not for BetterCharacter.

Another approach would be to use joints to attach the player to the platform and let the physics engine sort it out. Depends on the use case and other factors if it is a viable solution.

Thank you for the advice
, I will try to make the necessary changes, I come back as soon as it works.