How to make sure a player remains on a path.. ?

Started by
12 comments, last by dantheman1337 14 years ago
Note that collision detection and collision avoidance are two different things, and it seems like you are looking for the latter. Collision avoidance is a steering behavior that scans the area in front of an object, and if there is an obstacle within proximity, it steers the object away from the obstacle. Google "steering behavior" and you'll find a lot of stuff about it.
Advertisement
Quote:Original post by Palidine
This is more or less a "Solved Problem". Find and integrate a 3rd party physics engine to do the collision detection for you.


that would be for more advanced games i guess... m just starting with the simplest of all games..

Quote:Original post by Palidine
Trying to implement it yourself is a nightmare even if you know what you're doing;


thats exactly what i was dreading..

Quote:Original post by Palidine there's a reason they hire physics PHDs to make all the good physics engines.[smile]


i'll actually be that guy in a couple of years :P


Quote:Original post by Palidine
But yes, every frame of the game the new position of all objects in the world are tested for collision and collision is handled.


this was some part of knowledge i was looking for.. but its a bit hard to image cuz the checking conditions would be so much.. wont it slow down the game or something??

Quote:Original post by Palidine
plus or minus a few thousand other function calls:


snapped.


Quote:Original post by Palidine
If you really care about this topic, buy the book "Real-Time Collision Detection". It's amazing.

-me


what i basically want in making games is to know everything there is to know, like there may b many ppl making a game, but i wanna know everything they all know.. so that in d end, i have the idea what other person is doing, n i believe it might help to optimize the code somehow.. dunno if it really would... i'll have a look at the book..


Quote:Original post by nullsquared
Note that collision detection and collision avoidance are two different things, and it seems like you are looking for the latter. Collision avoidance is a steering behavior that scans the area in front of an object, and if there is an obstacle within proximity, it steers the object away from the obstacle. Google "steering behavior" and you'll find a lot of stuff about it.


you are very right sir.. due to lack of proper knowledge i couldnt discover collision avoidance.. so instead what i did, currently doing, is this: say our player is at point(x, y) i am checking whether the point (x+1, y) and/or the other three points collide with the paths of the walls.. a kinda checking the probability of collision in the future, the next point.. though the probability here is a set of two elements, 100% and 0%...
Thanks everyone for sharing so much knowledge..
what i did is when the game calls on the object, since i have objects positioned with xyz coords, like its a function, i have the collision detection in the function that draws the object. this helps with speed and you only need to code a little bit. its way more efficient but has pros and cons.

This topic is closed to new replies.

Advertisement