Changing\Switching Physics Controls

Is it common practice to change physics controls for my character?
For example: When it falls from the sky to the ground I want it to bound to RigidBodyControl but when it touches the ground I want to have all the abilities (walk, jump etc) of BetterCharacterControl. So is it OK to switch between controls?

I’m not sure if you’re asking the right question… Yes it’s fine to do this.

Usually the easiest way to get the answer you’re looking for is to describe what you’re trying to achieve, what you have done to simulate that action, and why it doesn’t do what you want.

If your way works - then its fine. There’s no reason why you can’t remove a physics control and/or add another.

Sure, thanks.
See this clip for reference
I like the behavior and performance of RigidBodyControl with the Sinbad character
but when it falls from the sky and touches the ground I need some way to get it back on his feet so I thought that maybe detaching the RigidBodyControl and replacing it with BetterCharacterControl will do the trick even though I prefer to continue using the RigidBodyControl

Actually I found a way to make Sinbad’s RigidBodyControl raise “back on his feet” but I have no idea why it works so I cannot rely on it.
Here is the code that does the trick:

ctl.applyTorque(new Vector3f(0, 0, 0));
Quaternion rot = ctl.getPhysicsRotation().fromAngles(x, y, z);

I think “why it works” would depend entirely on what x, y, and z are and how you found them.

No matter what values I’ll put in x,y or z (Usually I’m using just one of them and the others are zero), It will always put the character in the right position - “standing” up on the ground but I have to do both applyTorque and setPhysicalRotation to make it happen. If I just rotate it will not “stand” above the ground, Half of its body might be below the ground. I can post a clip to demonstrate it.

You probably just need to reset the rotation to zero (just give it a new quaternion) and set the linear velocity to zero so it stops continuing to move in whatever direction it was.

1 Like

Yeah… I’m going to have to say that I don’t believe you. For example, putting all 0, 0, 0 will effectively be a no-op.

What does this mean? What do you mean by “just rotate it”?

The reason I ask is because you are doing two things. 1) applying 0 torque, 2) rotating. (1) is not in question… you of course will have to do that. (2) is what we’re discussing and how the values of x,y,z should affect how/why it works.

Else you’ve left out another piece of the puzzle.

My point is that any value I tried with the setPhysicsRotation resulted in same way - putting the model on the ground. I didn’t try 0,0,0.

Anyway I liked the performance and behavior of the RigidBodyControl while falling from the sky to the ground but when being static in the ground I prefer to switch to CharacterControl and it works as expected (see clip below).
Switching from RigidBodyControl to CharacterControl

Thank you guys for the assistance. I just started using dynamic physics (non kinematic) and it introduces quite a few challenges… :slight_smile: