Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Movement angle and speed.
 

Movement angle and speed.

I'm just starting out here, and my first decision was to have my herbivore run away from carnivores...

The carnivore chasing me has a speed of 6, while I have a speed of 7. I have calculated the angle between his position and mine, and I have used that angle to determine my direction of travel. The carnivore always catches up. This does not make sense to me. Is speed relative to an organism's maximum speed?!?! 

Also, what is the deal with the "actualdirection" property? I have calculated the angle of an organization's travel by taking it's current position and it's destination, and the angle comes out to be up to 5 degrees different (either too much or too little).
MigrationUser 1  Sunday, July 13, 2003 3:17 AM
Well, I found out my first problem... when setting my destination position, I need to set the destination further than a distance of 5. With the distance at 5, the angle continuously changes (due to the fact that the destination point has coordinates as integers), making my herbivore move in an unnoticeable zigzag motion, therefore slowing him down.

But what is the point of "actualdirection"? I can't figure out why it's fluctuates in it's difference from the calculated angle.
MigrationUser 1  Sunday, July 13, 2003 11:09 PM
Speed:  I don't know why your carnivore is catching your herbivore.  One possible cause would be that you are limiting your herbivores actual speed by setting the destination too close to the current position.  For example, if you tell your herbivore to run at a speed of 7, but only tell him to run to a position that is 4 pixels away, your herbivore will only run 4 pixels.  He'll get there quickly, but his effective speed is only 4 and the carnivore will catch him.

ActualDirection:  I haven't tested this myself, but make sure that you are not getting confused by the latency of the data.  My "actual direction" was the direction I ran last tick.  Not the direction I told my bug to run this tick.

If this doesn't help (and I suspect it won't) post some code to demonstrate the problem.  It wouldn't be the first "bug" discovered in Terrarium (pun intended).  :o)
MigrationUser 1  Monday, July 14, 2003 12:58 AM

You can use google to search for other answers

Custom Search

More Threads

• taskvision can not work on w2k3
• How do i use .NET Application Updater Component to update outlook com addins
• why?
• Urgent !!!! please ;)
• "The terrarium server is experiencing temporary difficulties. This is probably why you are not receiving any animals. Please bear with us while we get the issue resolved."
• Starting out
• Terrarium Setup Help
• Direct ADO instead of Web Service
• delete more than one row in datagridview using checkboxes
• Does Visual C# Express Work?