Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have 3 spots, I would like to move my camera to using slerp. Just As seen in the image below. My question is how I can connect my camera to the first spot? I should be able to move between other spots after I connect my camera to the first spot.

Maybe a better way to ask is how can I make the camera location my first quaternion spot?

As seen in the image

share|improve this question
    
Which library to use is not a question that has a correct answer. If you'd like to modify your question to ask about implementing this yourself you should ask that instead. –  Byte56 Nov 7 '13 at 0:14
    
@Byte56 I edited my question. Thanks for the suggestion –  kim1989 Nov 7 '13 at 0:19
1  
Can you clarify what you mean by connecting the camera to the first spot? And clarify what you mean by making the location the first quaternion? Quaternions are used for rotation, not location. –  Byte56 Nov 7 '13 at 0:59
    
I assume he's using the quaternion for the orientation of the camera. You'd generally need to interpolate position along the curve and slerp to the desired orientation at the key frame points to get a solid cinematic camera movement. –  Sean Middleditch Nov 7 '13 at 2:35
1  
@kim1989:The first position is either an explicit position/orientation or it's a point long a curve. You could build a curve using the current position/orientation as a start and the first point you want to hit as the second element in the curve. –  Sean Middleditch Nov 7 '13 at 7:20

2 Answers 2

Usually, you define two routes for a camera flight. The first defines the position of the camera and the second defines the point the camera looks at. Both curves may be smoothed using Beziers or B-Splines.

I don't quite understand the part of your question about the quaternion. Quaternions are representations of rotation, like angles but unambiguous. You would find the rotation from orienting the camera to the current point on the lookat curve.

Another option would be to stay with one curve for the position and always looking forward. Then you would get the rotation from the derivative of the curve, strictly mathematically speaking. Practically, you would approximate this by choosing a point on the curve little ahead and one little behind the current position.

For example, see this animated image from Wikipedia, which illustrates the slope what is very similar to your lookat direction.

enter image description here

share|improve this answer

What you want to do according to the image is to move the position according to a bezier curve and then interpolate the position.

Bezier curves are quite common and I'm sure you'll be able to find code for it with some light googling.

A quaternion is the rotation of your camera, the position is what you want to move.

TLDR: Bezier curve + LERP

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.