Turok EX Modding Guide

Scripts kQuat

Quaternions are a way to represent 3D transformations, especially rotations.

The math behind them is fairly abstract, but the kQuat class makes it relatively easy to use them in more familiar terms of angles and axes.

Variables

float w, x, y, z

components of the quaternion

Constructors

void kQuat( float angle, float axisX, float axisY, float axisZ )

void kQuat( float angle, kVec3& axis )

build a quaternion representing the given rotation (in radians) about the given axis

void kQuat( kQuat& q )

copy constructor

Methods

kQuat& Normalize()

normalize and return a reference to self

Operators

kQuat * kQuat

combine the effects of sequential transformations

kVec3 * kQuat

apply a transformation to a vector

kQuat = kQuat

assignment

kQuat + kQuat

kQuat - kQuat

componentwise addition and subtraction