- Home /
Question by
PlayCreatively · Aug 11, 2021 at 11:23 AM ·
physics3dtorqueangularvelocity
Restrict additional torque force to max rotation velocity
I'm doing a 'roll a ball' game where you can gain speed over the max rotation velocity by going down ramps, but not by the player's input alone. So basically I need to restrict the player's input force from adding to the rotation velocity if it goes beyond the rotation limit.
I've tried to detract the force that's positive from the dot product and detracting that from the input force, expecting that I get a 0 from the dot product calculations afterwards, but that doesn't seem to be the case, so I guess there's more complications to the 3D dot product than the 2D one I know.
//deltaForce = player's input force
//vel = player's current angular velocity
float dot = Vector3.Dot(deltaForce, vel);
if (dot > 0)
deltaForce -= dot * vel.normalized;
Comment