simple Question about movement

Posts: 9
Joined: 2010.02
Post: #1
i'am fail on a simple question (shame on me)

i have an object with a position of
0.0, 7.49, 1.8
i like to move this object over a time (2 seconds) to the new position
0.0, 48.0, 71.0

first i get the direction-vector an normalize this

my animate-function looks like this
-(float)update :(float)timeElapsed
move the object with the normalized vector but how fast ???

anyone can helps me ??
Quote this message in a reply
Posts: 749
Joined: 2003.01
Post: #2
On the y axis you want to travel 48-7.49 in 2 seconds, so the speed on the y axis is (48-7.49)/2.

So to update the y position:

y+=(48-7.49)/2* timeElapsed

Same for x and z.

You can also do it with the normalized vector but you end up doing more calculations than you need

©h€ck øut µy stuƒƒ åt
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Posts: 1,403
Joined: 2005.07
Post: #3
You would like to move from A to B in t where t ranged from 0 to 2.

let u = t/2, so now u ranged from 0 to 1.

P(t) will be a function which gives you the position at time t,

You start at A, and away from A toward B, so:

P(t) = A + (B-A)*u
P(t) = A + (B-A)*(t/2)

So for example,

P(t).x = A.x + (B.x - A.x)*(t/2)

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Posts: 9
Joined: 2010.02
Post: #4
thanks, that works :-)
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  glutWarpPointer lag and fps movement Ropeburn 3 8,334 Jan 18, 2011 09:47 PM
Last Post: OneSadCookie
  3d Space Sensing movement? wonza 6 4,331 Dec 19, 2008 08:19 PM
Last Post: wyrmmage
  AI/Movement wonza 6 5,144 Nov 26, 2008 10:23 AM
Last Post: wonza
  simple question (private) imaumac 9 5,046 Oct 21, 2008 09:37 PM
Last Post: imaumac
  Registering window movement Muriac 12 5,912 May 12, 2007 12:55 PM
Last Post: impeacefull