Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to move an object in an arc, over time?

Author
Message
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 2nd Oct 2008 22:39
I have two 3d objects, and I want to move a third object between them in an elliptical arc. The start and end points are known and fixed. I also need the third object to travel the arc in a known time span (for instance, it must take 6 minutes to move from the start point to the finish point). The radius of the arc is up for debate, but it would be a horizontal arc moving from right to left.

I've been looking at some of the code for ballistic arcs, but they don't deal with known finishing points or a fixed time frame for getting the projectile to the target.

If anyone has any pointers on how to go about this, I'd greatly appreciate it.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Oct 2008 09:29
If it is designed to look good, rather than be accurate, I'd think about plotting your arc, putting the points in an array and interpolate between them. You'll get what you want and it will be a faster calculation.

calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 3rd Oct 2008 18:09
Ballistic arcs should not be elliptical - they must be parabolic.
Here's some projectile code I've made based on A-level formulae:



The optomist's right, The pessimist's right.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Oct 2008 18:44
Nice functions, Calcyman. I would still be tempted to precalculate these values into an array, if it's possible to create generic values with these calcs. For example, I do it with Sin/Cos as it reduces the timeslice of the calculations in a complex game enormously. Nobody sees the inaccuracy between 1 degree and the next.

Login to post a reply

Server time is: 2024-11-24 20:08:10
Your offset time is: 2024-11-24 20:08:10