simple Question about movement
hi,
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
anyone can helps me ??
thanks
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
Code:
-(float)update :(float)timeElapsed
{
move the object with the normalized vector but how fast ???
}anyone can helps me ??
thanks
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
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 ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
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)
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!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| glutWarpPointer lag and fps movement | Ropeburn | 3 | 5,506 |
Jan 18, 2011 09:47 PM Last Post: OneSadCookie |
|
| AI/Movement | wonza | 6 | 3,485 |
Nov 26, 2008 10:23 AM Last Post: wonza |
|
| simple question (private) | imaumac | 9 | 3,397 |
Oct 21, 2008 09:37 PM Last Post: imaumac |
|
| Really simple #pragma question | WhatMeWorry | 9 | 3,690 |
Dec 13, 2006 10:15 PM Last Post: Nick |
|
| Simple CarbonEvent Question | Abyssal | 3 | 2,759 |
Jan 1, 2006 09:53 PM Last Post: radiance |
|

