The problem is, that your code doesn't deal with the cut off that happens with 360 respectively 0. I did not look close enough at your code to fully understand it, but i think you should add code that deals with that scenario. I remember having a similar problem with one of my stacks, but didn't get around to solve it.

On a related note, did you look at AE from malte? It doesn't solve this problem, but has some nice handlers to simplify degree calculations and movements.

I made an other stack that moves a circle using AE, its linked on the forum (It has it's own problems though):
http://forums.runrev.com/phpBB2/viewtopic.php?t=234

There's a trial of AE available:
http://www.runrev.com/section/revselect/arcadeengine/index.php

greetings
Bjoernke


On 14 Jun 2007, at 21:16, Matthew wrote:

I am trying to write a game, and I need some of the objects to avoid other objects. I didn't want to use a complicated pathfinder, so I am just using Obstacle Avoidance. I have a problem with my script so that if the moving object has to go around an obstacle and in doing so goes around the very top of the obstacle (they are all circles), it gets stuck. The problem is that it uses the angle to the destination and the angle to the center of the obstacle to compare, and sometimes one of the angles are > 270 and the other is < 90, and it goes the wrong direction. I have posted the stack and you can just throw this in the message box:

go stack URL "http://revcompgeek.googlepages.com/obstacleAvoidance.rev";

Just right click somewhere and the mover will try to go there.
The code that needs to be changed is in the mover graphic, on the line that says

if obstangle < tangle then

--
Matthew Peterson
Programmer
Christa McAuliffe Space Education Center


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to