
Camera
Hi,
I''m actually trying to write a camera class which would allow the camera to follow a bezier curve in a 3d scene. Unfortunately, i''m having trouble to find information about how to implement this thing. I know how to define a bezier curve (3, 4 & n control points curves). What i''m having troubles to understand is how, while following the curve, does the camera react. Specially, given a source position and a target position, how do the view vector react along the curve. The camera position vector is i think the position on the bezier curve but how do i derive the camera view vector ? In advance for your help

Best Regards, RaPhiuS / PaRaSiTe


Best Regards, RaPhiuS / PaRaSiTe
The camera view would depend on what you the camera to do. Will it be looking at a specific location, that can be specified in the gluLookAt() command, or do you want it to follow the bezier curve?
if you want the camera to follow the curve, then the view vector would be at a tangent to the current position on the curve.
if the target position is fixed, then view from the camera would change depending on the angle between the current location on the bezier curve and the target.
(does that makes sense?)
if you want the camera to follow the curve, then the view vector would be at a tangent to the current position on the curve.
if the target position is fixed, then view from the camera would change depending on the angle between the current location on the bezier curve and the target.
(does that makes sense?)
Yes it make sense
That would be a good way to derive the view vector so i''m going to try this out
As you said, if i want to keep the view vector always pointing to the target how can i calculate the angle between the view vector and the target vector ? Thanx



Best Regards, RaPhiuS / PaRaSiTe
you can try using the dot_product from the view vector and the direction to the target. this would give you the angle
view vector = v.
direction to target = t.
v.t = vx * tx + vy * ty + vz * yz
|v|.|t| = sqrt(v.t)
angle = acos( v.t / (|v|.|t|) )
I think that''s right.. the dot_product is a standard formula, and a good example can be found in the articles and resources section under maths/physics...
view vector = v.
direction to target = t.
v.t = vx * tx + vy * ty + vz * yz
|v|.|t| = sqrt(v.t)
angle = acos( v.t / (|v|.|t|) )
I think that''s right.. the dot_product is a standard formula, and a good example can be found in the articles and resources section under maths/physics...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement