If you don't feel like math, use my tool. :P
http://devcrate.com/repository/.Tool...sions/QGen.exe
***********************************
See the lower half of my post for how to rotate objects by multiple amounts on multiple axes with one quaternion expression!
***********************************
Preface
This guide is aimed primarily at those who already understand the mathematical concepts at work here. Using this software involves rudimentary knowledge of trigonometry. If you don't know what this is, just stop reading here and go learn that.
As TheDeathArt has said, don't try to use software that is smarter than you.
* * *
Background
Kal (along with most software that involves the positioning of objects in a 3D coordinate system) utilizes quaternions to determine rotations of objects in the client; traditional Euler rotations using three angles are too ambiguous to be of any use to a computer.
A quaternion is a set of four values (W X Y Z) that are used in to specify a rotation in 3D space. To specify a particular rotation one needs to determine the axis about which the rotation is being made and the angle by which the object is to be rotated.
* * *
The OPL Editor
The interface of TheDeathArt's OPL Editor consists of:
-The filepath to the object (figure this one out for yourself)
-The vertical position of the object in the client (self-explanatory)
-Four fields labeled W, X, Y, and Z (the quaternion components)
-The scale of the object (again, self-explanatory)
To fill out the filepath, vertical position, and scale, all one needs is a very basic knowledge of Kal. The actual rotation of the object requires some thinking, and in some cases involving rotation in multiple directions, complex multiplication of quaternions (this is slightly more difficult than single rotations, they just take more time). I'll be dealing with that in a later guide; although most rotations dealt with in the Kal client are single quaternions, such as those used for rotating buildings and other objects along the Z axis only.
Each quaternion, as I mentioned before, has four components: W, X, Y, and Z. W determines the angle by which you will be rotating the object. W is cos( θ / 2 ). X, Y, and Z define the axis around which the object will be rotated. They reference a point on the unit sphere (for those of you who have not taken trigonometry, this is just the unit circle in three dimensions). A line segment is drawn from the origin to this point, and that becomes the axis around which the rotation occurs. X, Y, and Z are all multiplied by sin( θ / 2 ).
Thus:
W = cos( θ / 2 )
X = X*sin( θ / 2 )
Y = Y*sin( θ / 2 )
Z = Z*sin( θ / 2 )
So a rotation of 30 degrees about the z axis (0 0 1) would be:
W = cos( 15


Reply With Quote![[Tutorial] OPL Rotation with Quaternions](http://ragezone.com/hyper728.png)


