Entity Collision Help!

Blitz3D Forums/Blitz3D Programming/Entity Collision Help!

MCP(Posted 2004) [#1]
Hi all, Im writing a 3D space combat game and need help with collisions between ships. At this point in time a ship flies towards it's target, then STRAIGHT THROUGH IT before doubling back to repeat the process! I need to find a fast way for my ships to avoid their targets and/or other stationary objects by flying around/over/under them before returning to original flight path. Please HELP!


puki(Posted 2004) [#2]
A cube of waypoints is probably the easiest

WP...WP...WP
...................
WP...WP...WP
...................
WP...WP...WP

Once you have found the first (closest) waypoint you can put the ship (or whatever) on a precalculated path - which can still be random. You can pre-calc how they link and then pick a route. The waypoint structure can be dynamic and floating so there is no reason why it cannot move to a new target.

So, first of all you need to create your cube grid of waypoints - then work out the routes (not vital, but it makes it simpler else you have to do it real-time) between the nodes.

You'll have to think about the angles of flight between the waypoints - so that you don't get a zig-zag effect. Of course, you can bypass the logic by creating a sphere of waypoints - you don't need loads and loads, just enough to give the object a more realistic flight path and save coding the angles - the end result will be the object will pass through more waypoints and, if you precalc the links, then it will take you longer to connect them.

Probably best to start with the cube idea first. Imagine the waypoints as 'entities' - you can point to them and move to them - when you arrive at one whether it be by distance or assumed collision, you can move to the next one in the list.


Sledge(Posted 2004) [#3]
Or have your enemies aim for and fire at a child pivot in front of the player from a certain distance then swap to chasing a trailing pivot once they get close.


MCP(Posted 2004) [#4]
Thanks for the tips guys. I'm trying an idea thats similar to your suggestions. I'll let you know how it fairs! ;-)