collision detection advice

My objects move back and forth randomly and when they are close to each other they turn problem is they both turn the same direction so the objects move in a circle several times before other actions move them apart. How can i make it so that once the objects are close they move in OPPOSITE directions. I can’t figure a way to do it.

digiman

I think i understand whats happenning but hard to say a way to fix this without seeing your code.i assume you want a simple per-agent calculated colission avoidance routine? some kind of flocking cluster collision control might work better but prob more work.

Just using logic bricks no code but if you have some ideas or where i can look at some codes that will do what i want let me know

digiman

ok so your using logic bricks, what exactly is the goal? are you trying to create some kind of simulation?
anyway im not sure if you can do this without some coding, you have to compare relative vectors of movement to be able to set the appropriate motion on an object, i dont think there are any logic bricks for getting parameters of other objects.
you should be able to do this using a property that holds updated motion vector with very little code, im not particularly experienced at python so i wont try to tell you how, im sure there are tutorials on such things around thoguh try the tutorial index or check some linked sites.
if you can tell me a little more specifically what your after i might be able to suggest something specific.
cheers :slight_smile:

I’ll fool with it more I am just try to have my objects that are free moving avoid each other. Right now when objects detect each other they turn right but both objects turn in the same direction sevaral times almost like a dance which i don’t want. i might try using radar 9if object detect each sooner maybe that will work

digiman

without calculating relative movements i dont think you can get complete avoidance unless you use some kind of flocking behaviour. try using local coordinates for motion or using a pulse sensor that doesnt give constant input to turn maybe?