- Home /
Question by
AlexWalton · Sep 20, 2020 at 12:11 AM ·
rotationphysicsaxistorque
Frisbee throw - How would I add roll / pitch to a spinning object?
I'm making a frisbee throwing simulation. I'm trying to bank the disc left and right during its flight.
I've tried adding a rotational force around the x axis of the disc rigidbody. The problem I run into is that the disc is rotating around it's Y axis, so the X and Z axes are always spinning around.
I've also tried adding a parent object to the disc and rotating that, which doesn't work because the parent object transform doesn't move with the child disc object.
What other way could I add that rotation to a spinning object?
Here's the relevant section of my code:
//Apply force in the thrown direction
rb.useGravity = true;
rb.AddForce(direction * power, ForceMode.Impulse);
//Apply rotation force around the local Y axis
rb.maxAngularVelocity = 25;
rb.AddTorque(transform.up * 25); //Apply lift from the bottom of the disc
//Apply lift from the local Y axis when the disc is at high speed
speed = rb.velocity.magnitude;
if (speed > 20)
{
rb.AddRelativeForce(0,1.1f,0);
}
Comment