sorry for the bad writing im in a rush and im writing this on mobile
i have a custom ragdoll character which uses ballsocketconstraints, and alignorientation on the torso to keep itself upright. the strength of the alignorientation lowers as the health decreases. there’s a rigid alignposition connected to the hrp which allows it to actually move, but i want to make it so that when the torso loses balance, the character actually falls over like a normal ragdoll. I’ve seen games like advanced euphoria ragdoll do this but im not sure how i would go about doing this ..
What I would do is check the torso’s up vector and see how far off it is from vertical by dotting it with Vector3.yAxis. So, for example:
local dot = torso.CFrame.UpVector:Dot(Vector3.yAxis)
Then you can check the offset like this:
if dot < fallOverThreshold then
...
end
The threshold for falling over depends on your game. The dot product should return a value of -1 to 1, and the number will be closer to 1 the more upright the torso is.
I saw this solution already but was wondering if there were any other, more reliable physics based solutions. I guess this is the only one. Thanks anyways!
This should be pretty reliable. Having “lost balance” isn’t a strictly mathematical concept so anything more ‘realistic’ would require some sophisticated algorithm that constantly checks the dot product to see how much it is ping-ponging between values and how long it is a low value for.