Public Group

#### Archived

This topic is now archived and is closed to further replies.

# quaternion help needed

This topic is 5273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

im not converting my angle into radians, i dont even know if thatd help, and when i rotate the craft it shrinks and expands, ive read lots of tutorials and i dont know what im missing it seems like i dont understand the angles im supposed to use, or mabey its accumulating and i shouldnt let it do that, and mabey thats whats scaling my craft as it rotates, but i dunno i dont have to manualy multiply the vectors im using, its a function where i just input angle and vector, and ive run out of places to look i think, all the tutorials seem to just say the same things, the innner workings of a quat, and not the limits or range of the angles your supposed to put in, or something [edited by - dimension_x_son on June 6, 2004 5:31:00 PM] [edited by - dimension_x_son on June 6, 2004 5:31:52 PM]

##### Share on other sites
quote:

im not converting my angle into radians,

i dont even know if thatd help,

Quaternions use radians for rotations. If you''re using degrees, you''re rotating way too much.

The scaling is likely coming from doing your transformations out of order. Code?

##### Share on other sites
i didnt write the function im using,

its part of a 3d engine

i go object->orientation(radians, x,y,z)

object->orientation(.01, 0, 1, 0)

whats the upper limit of radians before i can just set the number back to zero,

in degrees when i reach 360 i set the number back to zero,
cause thats the same angle and it probably saves an amount of time if i dont accumulate a angle of 128761284736127834 degrees

if i still have trouble after finding this out ill go ask the engine people

can you realy realy briefly and generaly explain what kind of order im supposed to be using?

its just one function though,
its stands first in line all the time cause its the only function on the quaternion rotation attendance list

[edited by - dimension_x_son on June 6, 2004 7:20:27 PM]

##### Share on other sites
quote:
Original post by dimension_x_son
and when i rotate the craft it shrinks and expands

It sounds like there''s an accumulation of floating-point error. This usually happens when you do lots of small rotations and can result in the unexpected scaling that you''re seeing. Try normalizing (scaling it so that it''s magnitude=1) the quaternion occasionally and see if that helps.

quote:
Original post by dimension_x_son
and not the limits or range of the angles your supposed to put in,
or something

Try keeping it in the range of 0->2*pi (same as 0->360 degrees). Keeping the angles in this range will also help with errors due to lack of precision.

##### Share on other sites
yuk,

wait i have something to look at

but i hate this,

it feels like i could re write and make me turnions faster then learning quaternions

how fast is pitch and yaw?(just thinking out loud)

the normalising helped so my craft stays the same size,
which is neat quaternions are neat,

but my angles get stuck and i cant rotate all that way without it getting suck and becoming stationary,

and it dissapears sometimes when i twist too much,
and i thought i was conserving the degrees by

i dunno this

CODE

if (mInputDevice->isKeyDown(KC_RIGHT))
{
//mCamera->yaw(-mRotScale);
Quaternion PQ = player->getOrientation();
if (seeradians < 0) { turnRADians = 6.283185; }
Quaternion quat = Quaternion(turnRADians, PQ.x, PQ.y, PQ.z);
Real NQD = sqrt(quat.x * quat.x + quat.y * quat.y +
quat.z * quat.z + quat.w * quat.w);
quat.x /= NQD;
quat.y /= NQD;
quat.z /= NQD;
quat.w /= NQD;

player->setOrientation(quat);
}

if (mInputDevice->isKeyDown(KC_LEFT))
{
//mCamera->yaw(mRotScale);
Quaternion PQ = player->getOrientation();
if ( seeradians > 360) { turnRADians = 0; }
Quaternion quat = Quaternion(turnRADians, PQ.x, PQ.y, PQ.z);
Real NQD = sqrt(quat.x * quat.x + quat.y * quat.y +
quat.z * quat.z + quat.w * quat.w);
quat.x /= NQD;
quat.y /= NQD;
quat.z /= NQD;
quat.w /= NQD;

player->setOrientation(quat);
}

##### Share on other sites
i have a pad

but i hate it

i need a new one

so i use the keyboard

and dont go out during the day

to get one

can you figure out the code or should i comment it heavily

mabey seeradians should be named degrees

figuring out ellipsoids gave me this much trouble,

and i had to mix together three peoples htmls on it

[edited by - dimension_x_son on June 8, 2004 12:54:44 PM]

##### Share on other sites
nobodys sugestions helped me with ellispsoids

and they doesnt sink into what its sliding on at any time
ever
im proud

or i mean and they dont mess up on angled walls

and i dont have and lights to have to slide around on the walls, but im thinking they wouldnt stop me either from bring smooth

[edited by - dimension_x_son on June 8, 2004 12:59:02 PM]

##### Share on other sites
quote:
Original post by dimension_x_son
nobodys sugestions helped me with ellispsoids

and they doesnt sink into what its sliding on at any time
ever
im proud

or i mean and they dont mess up on angled walls

and i dont have and lights to have to slide around on the walls, but im thinking they wouldnt stop me either from bring smooth

[edited by - dimension_x_son on June 8, 2004 12:59:02 PM]

I can''t really help you with your problem, except that normalizing the quaternion occasionally is the right thing to do, but I wanted to point out that your posts read very much like haiku poetry, and I appreciated that this early in the morning.

Also, your steering code using radians in the first direction, but when steering left you are checking if the radians are greater than 360. Radians are a measurement around the unit circle and total 2 * PI. So you need to do if ( radians < 0 ) radians = radians + 2 * PI. and if (radians > 2 * PI) radians = radians - 2 * PI

Hope that makes sense.

Keep up the good poetry, and I''m sure you''ll find a sollution.

##### Share on other sites
not any solutions that anybody knows about

grins evil

##### Share on other sites
how sick and retarded is this if i can do (fzero + 4X4)suspension + rpg + out door footprints + baking textures + tractor beams + moving tracKS + callibrated jumps + vertigo + end guys + all by myself + pathfinding + mind opening amounts of interaction + whut else was i gonna sai? OH and pLUS wATER + octrees complex cousins

could i get the time to import bsp trees into my engine that i did?

or i dunno

theres a poem

[edited by - dimension_x_son on June 8, 2004 2:21:41 PM]

[edited by - dimension_x_son on June 8, 2004 2:23:09 PM]

[edited by - dimension_x_son on June 8, 2004 2:23:33 PM]

[edited by - dimension_x_son on June 8, 2004 2:24:20 PM]

[edited by - dimension_x_son on June 8, 2004 2:25:38 PM]

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633313
• Total Posts
3011315
• ### Who's Online (See full list)

There are no registered users currently online

×