WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 09-26-2008, 02:45 PM
whj whj is offline
Member
 
Join Date: Apr 2008
Posts: 60
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.
Reply With Quote
  #2  
Old 09-29-2008, 10:45 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #3  
Old 10-01-2008, 10:49 PM
whj whj is offline
Member
 
Join Date: Apr 2008
Posts: 60
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!
Reply With Quote
  #4  
Old 10-02-2008, 12:16 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #5  
Old 10-06-2008, 04:38 PM
whj whj is offline
Member
 
Join Date: Apr 2008
Posts: 60
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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


All times are GMT -7. The time now is 12:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC