How to lock a rotation axis of a rigidbody like in Unity?

Hi, I was wondering how I should do to prevent a capsule rigidbody from falling (rotation wise, not making the capsule fall and roll, just falling and standing)

I am trying to reproduce a small test project from Unity to Xenko where i have a capsule and move it left and right using addforce and clamping the velocity

i’ve been able to reproduce most of the stuff fairly easily but the kind of easy part of unity is driving me nuts in xenko

in unity a simple checkbox in the rigidbody component is sufficient for locking a rotation axis

in xenko I can’t find something similar at all, and I ended up looking at constraints, but even in constraints, there’s stuff like point2point etc, but it has nothing to do with locking the Y or X rotation for instance

I tried the character component after that, it seems to prevent the rotation, however, it removes the ApplyForce function so it loses interest

If you look at the 6DOF constraint you can probably work out a way to do locking of rotation, but I think this might also be a good thing to open an issue on in the repo and request, I think it’d be of use for many

I’ve opened an issue on the github

I’ll look at the 6DOF, thanks
I hope it won’t be too hard since atm I don’t know a lot about physics, like basically, the project i’m porting was basically a training project my teacher made to teach me basic physics in video games

1 Like
I looked at this, and unfortunately i feel like it doesn’t help me at all
I can’t figure out how to lock specific rotations and positions

I’ve used the 6DOF constraint personally in my sample repo, might want to check it out for guidance/a starting point:

On the github, someone told me to set the values LinearFactor and AngularFactor i needed to freeze to 0, and it seems to have fixed the problem in an easier way

1 Like