Trajectory path and movement (as well as reintroducing myself)
Player_E
Member, PRO Posts: 604
First off I want to say hello to everyone. I'm an old time user back from early 2009, I took a break for a little over a year due to some time constraints and now i'm back.
now to get to my question. I've been working on a new project for a little over a week now and have been stuck on figuring out how to work trajectory path for a moving object.
I have found this video searching the forums and this is exactly what I am looking for:
Yes, I know Orbz has a trajectory demo over on gshelper.com and I have been fussing with that demo for a little over 3 days now and still cant figure out how the guy (genius) in the video accomplished what he did.
Any help or direction would be very much appreciated.
Thank you and its good to be back, im super excited about my new project
now to get to my question. I've been working on a new project for a little over a week now and have been stuck on figuring out how to work trajectory path for a moving object.
I have found this video searching the forums and this is exactly what I am looking for:
Yes, I know Orbz has a trajectory demo over on gshelper.com and I have been fussing with that demo for a little over 3 days now and still cant figure out how the guy (genius) in the video accomplished what he did.
Any help or direction would be very much appreciated.
Thank you and its good to be back, im super excited about my new project
Comments
From my math experience my initial instinct is that I would need to use a derivative of the function (equation) that created my trajectory path since a derivative calculates the instantaneous rate of change. I have come up with what I believe works, but under some circumstances it fails.
this is what I have
under the arrow actor that is spawned when shot
timer: every 0.1 seconds
rotate to angle
angle = -(velocity*cos(launch_angle))
speed = distance traveled/time of flight
explanation of the speed portion. I used a formula that calculated the total X distance traveled along the horizontal plain according to the velocity and angle used. I also used a formula that calculated the time the arrow would be in the air along the trajectory path. so in order to get the speed of the rotation I used the simple speed = distance/time formula
explanation of the (-) in front of my angle equation is because the negative makes the arrow head lean down towards the ground while a positive angle would make it lean up towards the sky.
this works when there is an extreme curve to the trajectory, but doesn't work at all when the path is more flat.
Can anyone let me know if I am on the right path with my thinking of the derivative, or if I'm looking in the wrong place all together.
Any help would be great
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User