Moving an arrow over Bezier curve
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.
Well, if you are placing the arrow at some value of t along the curve, why not also calculate t+(small number), and make it point towards that?
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.......
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.
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.
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.
You could also use the derivative of your Bezier function if you got really ambitious :-D.
~SPH
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement