Collision Detection? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Collision Detection? (
/showthread.php?tid=391990)
Collision Detection? -
NumbSkull - 12.11.2012
so i have been trying to find a way to make the objects i move crash into(either stop or explode) when they hit something like a building wall ...but the pass thru i can make the stop and explode just fine on timers and distance formulas but they pass thru the wall first ...any sugestions on a way to detect collisions? please and thank you
Re: Collision Detection? -
Sinner - 12.11.2012
Quote:
...but the pass thru i can make the stop and explode just fine on timers and distance formulas but they pass thru the wall first ...any sugestions on a way to detect collisions? please and thank you
|
The only way to prevent this is when you would have the diameter of the object, or the actual object size. Since you don't have either (only the middle X, Y and Z coordinate) I don't think this would be possible. If you only use 1 type of object you may determine it's diameter through trial-and-error, but that wouldn't be at all dynamic.
Re: Collision Detection? -
NumbSkull - 12.11.2012
it is more of a custome weaponry project for an arena FS i made so the objects will be shot from different locations they blow up near players but pass thru walls ...i can map out each wall ...but i would like a universal fix for collision if i want to place it in a new int
Re: Collision Detection? -
Mauzen - 12.11.2012
Theres no universal method. If the walls are custom placed objects, you need to check the collision for each of them. A good and quite efficient way would be using planes. I once wrote about how to realize collision detection with planes, but dont feel like searching my own old post.
Edit: Here it is:
http://forum.sa-mp.com/showpost.php?...5&postcount=18
Re: Collision Detection? -
NumbSkull - 13.11.2012
i think you are talking about if they are solid and you can walk thru them? i mean when the moving object touches them for it to detect that it hit a wall and bounce/explode/stick to it i can do all the code for the bounce/explode/stick to it i just dont want to make a clause for each point it can touch saying if object hits these cords turn it around ...just too many walls and points on the wall for that