HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How does Quaternion Rotation work?!!!

07-17-2006, 04:25 PM#1
MasterofSickness
After confusing my head over several hours with how I have to use this, I give it up, because otherwise I would have to jump out of the window...

All I wanne do is that particles fly in one special direction, but all I get are directions like 90 degree and vertical ones, although I only want a horizontal one!
I read this thread from extrarius many times, but I don't understand how they work at all *argh
What I have at the moment is this:
Code:
ParticleEmitter2 "BlizParticle01" {
	ObjectId 1,
	Unshaded,
	static Speed 100,
	static Variation 0.01,
	static Latitude 0,
	static Gravity 0,
	Visibility 1 {
		DontInterp,
		130000: 1,
	}
	LifeSpan 0.7,
	static EmissionRate 60,
	static Width 120,
	static Length 120,
	Additive,
	Rows 1,
	Columns 1,
	Tail,
	TailLength 1.3,
	Time 0.5,
	SegmentColor {
		Color { 0.0588235, 0.631373, 0.992157 },
		Color { 1, 1, 1 },
		Color { 1, 1, 1 },
	},
	Alpha {90, 100, 0},
	ParticleScaling {15, 10, 5},
	LifeSpanUVAnim {0, 0, 1},
	DecayUVAnim {0, 0, 1},
	TailUVAnim {0, 0, 1},
	TailDecayUVAnim {0, 0, 1},
	TextureID 5,
	Rotation 2 {
		Linear,
		0: { 0,  -0.924,  0,  0.924 },
           130000: { 0,  -0.924,  0,  0.924 },
	}
}
But that just makes the particles come from the east!!!!!!! *crying*
and I need particles that come from the north-east and go to the south-west...

What values do I have to use for the rotation???

I'm just missing numbers and that is what makes me so angry, I can't find the right ones!!
Please please help...
07-17-2006, 04:48 PM#2
Jacek
Code:
Q56. How do I convert a rotation axis and angle to a quaternion?
----------------------------------------------------------------

  Given the rotation axis and angle, the following algorithm may be
  used to generate a quaternion:

    ------------------------------------------------
    sin_a = sin( angle / 2 )
    cos_a = cos( angle / 2 )

    q -> x    = axis -> x * sin_a
    q -> y    = axis -> y * sin_a
    q -> z    = axis -> z * sin_a
    q -> w    = cos_a

    quaternion_normalise( q );
    ------------------------------------------------

  It is necessary to normalise the quaternion in case any values are 
  very close to zero.

hope it will help you if you manage to get the needed values
07-17-2006, 04:51 PM#3
Rao Dao Zao
Perhaps a program such as Milkshape to dummy the rotation, export, and copy the key values into your emitter?
07-17-2006, 07:03 PM#4
MasterofSickness
@Jacek
The formula on how to count the values was also in the linked thread:
Quote:
Convert an axis and angle pair to a quaternion is simple:
XR = Sine(Angle/2) * X
YR = Sine(Angle/2) * Y
ZR = Sine(Angle/2) * Z
WR = Cosine(Angle/2)

My problem IS that I need values for X,Y,Z and W and the angle.
By the way, what exactly are those values stand for?
If I would want to rotate in a horizontal plane, then I would use the Z-axis right?
And for vertical I would use the X- or Y-axis...
but what is this W??? I have no idea what that is?? So figuring out the angle and the right axis (as 1) will become almost impossible...
I seriously need an explanation!


@ Rao_Dao_Zao
Hmm, but how do I creat a particle in Milkshape... Never tried that...


EDIT:
Oh, well,
I have read that this is a little higher math:
1. the reals
2. the complex
3. the quaternion
And I only know of the reals...
Then, if noone else knows about them, I will have no other chance than to "play" arround...


EDIT2:
OH MY GOD!!!!
It works!! yay!!!
Oinkerwinkle is the man who showed it and helped out with a very nice tool!
+rep, thx a lot!