![]() |
|
#1
|
|||
|
|||
Hi, Jeff
That's really helpful! Thanks a lot! I have another question. Is there any way I can get the current speed of the object, like accessing some environment variable? The reason I need it is because when I accelerate cars I need set the new speed based on the current speed. |
#2
|
|||
|
|||
Would it work for you to use animationpath.constantspeed when you begin. Then you would know the initial speed and you could change based on that.
|
#3
|
|||
|
|||
I do use animationpath.constantspeed when I begin. But what I need to know is not only the initial speed. If I want to accelerate or decelerate a car, I would like to increase or decrease the car based on not the initial speed, but the speed when last timer event triggered.
For example, the initial speed is 20mi/hr. To avoid clash, I calculate certain distance every 20 times a second. While the distance is too close, one car keep speeding up 20 percent and the other car keep slowing down 20 percent. So one car could speed up to 20 + 20*0.2 = 24mi/hr, 24 + 24*0.2 = 28.2mi/hr, (I need to know the current speed is 24) 28.2 + 28.2 *0.2 = 34.56mi/hr, (I need to know the current speed is 28.2) and so on; and the other car could slow down to 20 - 20*0.2 = 16mi/hr, 16 - 16*0.2 = 12.8mi/hr, (I need to know the current speed is 16) 12.8 - 12.8*0.2 = 10.24mi/hr, (I need to know the current speed is 12.8) and so on. Sorry about the trivial details. Do you think it is feasible? Thanks a lot! |
#4
|
|||
|
|||
Let me know if I am not understanding this correctly, but couldn't you have a variable for each car that stores its current speed. When you need to accelerate or decelerate just access that variable and change it. Then set the animation path to the new carspeed.
|
#5
|
|||
|
|||
Yes, that's exactly what I want. If there is a system defined variable about current speed, something like get.speed(), then I don't need to maintain them by myself. That's why I'm asking. But if not, I will do what you said.
Thanks a lot. |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Real Time Audio Data | lomendil | Vizard | 2 | 06-02-2008 08:18 PM |
Can I get real time Intersense tracking data from another computer on the network? | GoldenSun | Vizard | 4 | 04-30-2008 07:42 PM |
timer question | Elittdogg | Vizard | 5 | 10-10-2007 02:49 PM |
Animation Path | djdesmangles | Vizard | 2 | 06-11-2007 03:37 PM |
Animation Path | djdesmangles | Vizard | 0 | 06-06-2007 11:03 AM |