Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/120665028583104512
Fixed a typo.
Source Link
Metaphile
  • 233
  • 2
  • 5

Euler angles are much more intuitive to me than quaternions for representing 3-dimensional rotations. In fact, I barely understand quaternions at all. I use quaternions for rotation because people with more knowledge than me say they're better. (I'm familiar with the gimbal lock problem and axis-angle rotations, but that's getting away from the point.)

Given my nebulous understanding, what I'm trying to do might be really stupid. I want to rotate an object by applying an angular force (torque) which I'm representing as a quaternion plus a duration. To move the object, I do something like

abstract class PhysicsBody
    {
    protected Vector3 velocity = Vector3.Zero;
    
    public void ApplyForce(Vector3 force, float duration)
        {
        // mass and other concepts omitted for brevity
        this.velocity += force * duration;
        }
    }

and it works as expected. I figure rotation should work similarly, like so:

...

protected Quaternion orientation = Quaternion.Identity;

public void ApplyTorque(Quaternion torque, float duration)
    {
    this.orientation *= torque * duration;
    }

But of course it does not. If duration is less than 1, orientation does not change. If duration is greater than 1, things get weird and break after a few seconds.

I've experimented with renormalization, but I'm fumbling in the dark. What is the "correct" way to do this?

Euler angles are much more intuitive to me than quaternions for representing 3-dimensional rotations. In fact, I barely understand quaternions at all. I use quaternions for rotation because people with more knowledge than me say they're better. (I'm familiar with the gimbal lock problem and axis-angle rotations, but that's getting away from the point.)

Given my nebulous understanding, what I'm trying to do might be really stupid. I want to rotate an object by applying an angular force (torque) which I'm representing a quaternion plus a duration. To move the object, I do something like

abstract class PhysicsBody
    {
    protected Vector3 velocity = Vector3.Zero;
    
    public void ApplyForce(Vector3 force, float duration)
        {
        // mass and other concepts omitted for brevity
        this.velocity += force * duration;
        }
    }

and it works as expected. I figure rotation should work similarly, like so:

...

protected Quaternion orientation = Quaternion.Identity;

public void ApplyTorque(Quaternion torque, float duration)
    {
    this.orientation *= torque * duration;
    }

But of course it does not. If duration is less than 1, orientation does not change. If duration is greater than 1, things get weird and break after a few seconds.

I've experimented with renormalization, but I'm fumbling in the dark. What is the "correct" way to do this?

Euler angles are much more intuitive to me than quaternions for representing 3-dimensional rotations. In fact, I barely understand quaternions at all. I use quaternions for rotation because people with more knowledge than me say they're better. (I'm familiar with the gimbal lock problem and axis-angle rotations, but that's getting away from the point.)

Given my nebulous understanding, what I'm trying to do might be really stupid. I want to rotate an object by applying an angular force (torque) which I'm representing as a quaternion plus a duration. To move the object, I do something like

abstract class PhysicsBody
    {
    protected Vector3 velocity = Vector3.Zero;
    
    public void ApplyForce(Vector3 force, float duration)
        {
        // mass and other concepts omitted for brevity
        this.velocity += force * duration;
        }
    }

and it works as expected. I figure rotation should work similarly, like so:

...

protected Quaternion orientation = Quaternion.Identity;

public void ApplyTorque(Quaternion torque, float duration)
    {
    this.orientation *= torque * duration;
    }

But of course it does not. If duration is less than 1, orientation does not change. If duration is greater than 1, things get weird and break after a few seconds.

I've experimented with renormalization, but I'm fumbling in the dark. What is the "correct" way to do this?

Source Link
Metaphile
  • 233
  • 2
  • 5

Problem representing torque as a quaternion

Euler angles are much more intuitive to me than quaternions for representing 3-dimensional rotations. In fact, I barely understand quaternions at all. I use quaternions for rotation because people with more knowledge than me say they're better. (I'm familiar with the gimbal lock problem and axis-angle rotations, but that's getting away from the point.)

Given my nebulous understanding, what I'm trying to do might be really stupid. I want to rotate an object by applying an angular force (torque) which I'm representing a quaternion plus a duration. To move the object, I do something like

abstract class PhysicsBody
    {
    protected Vector3 velocity = Vector3.Zero;
    
    public void ApplyForce(Vector3 force, float duration)
        {
        // mass and other concepts omitted for brevity
        this.velocity += force * duration;
        }
    }

and it works as expected. I figure rotation should work similarly, like so:

...

protected Quaternion orientation = Quaternion.Identity;

public void ApplyTorque(Quaternion torque, float duration)
    {
    this.orientation *= torque * duration;
    }

But of course it does not. If duration is less than 1, orientation does not change. If duration is greater than 1, things get weird and break after a few seconds.

I've experimented with renormalization, but I'm fumbling in the dark. What is the "correct" way to do this?