Skip to main content
gamedev.net
🔒 Locked

Slerp?

Started by Kestrel Apr 9, 2001 at 4:35 PM 4 replies 1k views
Original Post
Kestrel
Kestrel
I got quaternions work and now I want to use slerp. The problem is I dont know how to use it. I know what the from, to and res arguments are for but what is th t argument for. How many times do I call the function after the user changes their view. I got the code from a http://www.gamasutra.com/features/19980703/quaternions_01.htm Edited by - Kestrel on April 9, 2001 5:36:57 PM
Gabhonga
Gabhonga
relax, man, that "t" parameter is the timeslice of the operation, wich ranges from 0 to 1 with most slurpers and results the function to give you the quaternion wich represents the interpolated rotation between the two rotations wich are put into the function...
I would update the objects rotation matrix/quaternion each frame to get it real smooth (or at least with a rate of about 25 times per second, otherwise it''ll go chunky).
good luck!


muhuhahahahahaha!!!!!!!!
who cares about signatures, anyway....
muhuhahahahahaha!!!!!!!!who cares about signatures, anyway....
Kestrel
Kestrel
I aready have it working the way I want it to except for the fact that the camera''s rotation slows down to much.

i.e for a 180 degree rotation, the last 20 degree''s takes long than the first 160. or some thing like that.

but thanks any way.
Puppet
Puppet
Well that is due to ''t'' being realtive to the angular difference between the two rotations. I.e if the angular difference is 40degrees and t = 0.5, then the rotation would be 20degrees. And if angular difference is 10degrees and t = 0.5 then the rotation would be 5degrees, it''s all relative. You should figure out the angular difference between rotations and use that value to calculate how big t should be to rotate constantly.
Gabhonga
Gabhonga
right, I always forget about that, you''ve got to watch that you''re traveling on the surface of a 4d sphere that gets mapped to a rotation in 3d, and that''s not linear...imagine a circle in your coordinate system and you''re coming from the left, a bit displaced to the middle of the circ. to the circle and you''re gliding to the top of it by it''S surface. first the tangent of the surface is almost horizontal, but as you move further right it first rapidly gets flatter, but that slows down, till you''re on the top of the circle and the tangent is horizontal...
muhuhahahahahaha!!!!!!!!who cares about signatures, anyway....
Gabhonga
Gabhonga
but watch out that slerping isn''t always the best to do, for example it''s nice for external views, but you might maybe rather use 3d spline curves for some cases (like interpolating movement :-)) and not rotations...these are mostly smooth enough so you can just set a fixed point for the cam to look at). but I''ve also got nice results with just attaching the camera point to be inside the head-bone of a character and to look always forward to that bones direction (you may then use keyframes/i.k. to adjust the direction the player is looking...)
muhuhahahahahaha!!!!!!!!who cares about signatures, anyway....

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.