|
| Haron |
Post
#1
|
|
Newbie Group: Members Posts: 7 Joined: 24-December 06 From: Cadiz (Spain) Member No.: 628 |
hi everybody.
I use a bezier path to perform a camera translation, like this: var movement = new PathInterpolator(e.create(), 50, path); // path is the bezier curve this.camera.setInterpolator(movement); it's working. but I'm looking for a way to move the camera along the curve following its "velocity vector": (IMG:http://serverstone.com/tmp/sample.gif) the camera goes from the point A to the point B always looking ahead. it is possible??? thanks a lot (and sorry for my English) This post has been edited by Haron: Jan 14 2007, 11:31 PM |
| Petit |
Post
#2
|
|
Advanced Member Group: Moderator Posts: 587 Joined: 21-June 06 From: Borgholm, Sweden Member No.: 38 |
I use a bezier path to perform a camera translation, like this: the camera goes from the point A to the point B always looking ahead. it is possible??? Have my first thought! The Camera3D has the lookAt( x, y, z ), which would have to be called for each movement. The camera moves one step per frame. It would be possible to calculate the current position on the path. Listening for the worlds onRenderEVENT, the event handler could calculate the tangent vector to the path at that point. Then use the camera.lookAt() method to look at a point on that vector. Seems like a lot to do. Hopefully there is a lazier method (IMG:style_emoticons/default/wink.gif) |
| kiroukou |
Post
#3
|
|
Administrator Group: Root Admin Posts: 910 Joined: 12-June 06 Member No.: 1 |
Hi,
Yes there is a much simpler method (IMG:style_emoticons/default/wink.gif) Since you are at a special position (which you can retrieve easily) and that you know your view vector direction, just create a point in front of you, let say : lookAtPoint.x = CamPosition.x + ViewVector.x * aDistance; lookAtPoint.y = CamPosition.y + ViewVector.y * aDistance; lookAtPoint.z = CamPosition.z + ViewVector.z * aDistance; The distance is whatever you want, but positive! Each onRenderEvent set the lookAt vector to this point and that would be ok (IMG:style_emoticons/default/wink.gif) ++ |
| Haron |
Post
#4
|
|
Newbie Group: Members Posts: 7 Joined: 24-December 06 From: Cadiz (Spain) Member No.: 628 |
thanks kiroukou and Petit. (IMG:style_emoticons/default/wink.gif)
|
| Lo-Fi Version | Time is now: 10th August 2007 - 04:42 AM |