rapier icon indicating copy to clipboard operation
rapier copied to clipboard

Ability to set a maximum velocity.

Open viridia opened this issue 3 years ago • 0 comments

I'm primarily doing character animation, and the way I have been doing it is to manually set the velocity of the rigid body. I don't want to use a kinematic body for this purpose because I still want the character to be able to run into walls and other obstacles, and trying to manage all those collisions myself, and calculating the vectors for sliding against surfaces seems pretty complex. Setting the velocity works really well on flat surfaces, but not so well on slopes and ramps.

It seems to me that one thing that would be helpful for characters would be the ability set a speed limit constraint, similar to the linear damping factor, except that it imposes a maximum velocity. (In fact, it may just be a non-linear linear damping, one that increases as the character nears the speed limit).

If you think about it, the movement of humans and animals is not governed by some idealized Newtonian equation of friction and acceleration (well, yes it is, but that is not the major factor). For organic limbed creatures, the primary limiting factor is their gait - how fast they can move their legs. A character that continues to accelerate can't go any faster than their muscles can oscillate their bones. This rate will be different for different gait types, of course - walking vs. running / trotting / galloping and so on. And there are circumstances (free-fall, walking on slippery ice) where the rules will have to be modified.

But it seems like having the ability to set a max velocity would be a good start towards modeling these kinds of movements.

viridia avatar Apr 25 '21 07:04 viridia