Sign in to follow this  
Omar Alvi

Moving an arrow over Bezier curve

Recommended Posts

Omar Alvi    100
Hello people, I am trying to learn few things in 3d(opengl). Ammm and i am stuck .....ahhh. Okay i have a bezier curve(circular curve) and an arrow. Now i want this arrow to follow the path on the curve. Though i have been able to move the arrow on the curve but it constantly points in one direction it should point in the direction in which it is moving along the curve and i dont know how to do this can some one please help. I have posted the project on http://gamearena.freeserverhost.com download the Project1 from the website. The arrow moves from the left and right arrow keys.......Hope to hear from you guys soon.

Share this post


Link to post
Share on other sites
Omar Alvi    100
Hmm can you tell me how to do that i am new to opengl. I have shared the project on http://gamearena.freeserverhost.com download the Project1 from the website. The arrow moves from the left and right arrow keys.......

Share this post


Link to post
Share on other sites
TravisWells    276
This isn't anything OpenGL.
I assume you are currently doing something like:

x,y = bezierCurve(time)

So you can just do

nx,ny = bezierCurve(time + 0.1)

And have the arrow be positioned at x,y (like normal) but pointing at nx,ny.

Share this post


Link to post
Share on other sites
Fidde A    128
You can do it to ways: a) Get the normal of the Bezier curve analytically or b)Keep the last evaluated coordinate, and create a vector between the current and the last coordinate. Both will give you an orientation to align the arrow by.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this