Skip to content

Incorrect quaternion vector rotation #4

Description

@Illation

I was looking at the code for quaternion vector rotation (multiplication) (line 141, math/linear_algebra/quaternion.h), and it seems to me that the formula shown in the comment was incorrectly applied in the implementation. I didn't test the engine directly but I wrote my own version of quaternions and tested that.

The correct implementation would probably look something like this:

return (2*(quat.w*quat.w)- 1.0f)vec + 2.0f(dot(quat.r, vec)quat.r + quat.wcross(quat.r, vec));

This version worked for me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions