Interpolating vehicle positions between ScoringUpdates using quaternion

Discussion in 'Plugins' started by The Iron Wolf, Nov 29, 2016.

  1. The Iron Wolf

    The Iron Wolf Registered

    Joined:
    Feb 20, 2016
    Messages:
    984
    Likes Received:
    984
    Hi,

    I am working on a shared memory plugin for rF2. I am not familiar with quaternions, but from what I read they might save me some cos/sin calls. In fact it's been many years since I worked on 3D games, so pardon for being noob.

    Currently, interpolation is done this way:
    · Calculate new localRotation based on rotationAcceleration.
    · Convert localRotation to world coordinates.
    · Build new orientation matrix by rotating around three axes. (this requires 12 sin/cos + 3 sqrt) calls per car.

    From what I read here http://www.cprogramming.com/tutorial/3d/quaternions.html I can reduce this to 4 calls + 1 sqrt per car. My issue is I don’t get how to get Angle mentioned in the article from rF2’s localRot? One thing I could think of is to rotate by each component, but that eliminates the benefits and I save nothing.

    Thanks!
     
    Last edited: Nov 29, 2016

Share This Page