Objects collision
#1

I wonder if anyone has an idea how to detect a collision between two dynamic objects while one of them is a wall and the other one is moving (using MoveObject). ColAndreas is pretty useless in that scenario since its not supporting moving objects.

Would appreciate any idea, thanks.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=606308
https://sampforum.blast.hk/showthread.php?tid=446286
Reply
#3

First topic is about removing a collision?
Second plugin doesn't help, it spams ackslimit cause it uses way too many data, and it doesn't work.
Reply
#4

does this help you ?

Reply
#5

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
does this help you ?
Quote:

ColAndreas is pretty useless in that scenario since its not supporting moving objects.

I've wrote this.
Reply
#6

my bad,sorry mate. i don`t have any other ideas.
Reply
#7

Look for cimulator. It does that and more pretty well.

ColAndreas however could still be used. Is the object moving at a constant speed? Is the wall static?

If so, you can calculate at which position the object would hit the wall based on closest collision point to the wall and its speed and distance, then calculate the time it takes to get there.

You could raycast along the movement's path till it hits the wall and save that position (that will be roughly the coordinates at which the moving object would touch the wall). Now you do the same for the moving object in the opposite direction and retrieve the offset from the center to the collision point. Now the first offset plus the second offset would be the distance between these two objects when they touch (the target position for the moving object). However this does not work for all kind of objects and can be inaccurate, but it could be sufficient for what you are trying to do.

A better result would be using CA_ContactTest() with a big plane, repeatedly checking if the plane collides with the moving object at different distances, until it does. Then you know the closest collision point to the wall and can calculate a distance at which they touch with a bit better accuracy. This step only has to be done once (NOT while the object is actually moving) so even if the calculation would take a bit, it wouldn't matter (but CA is fast, so that won't happen).

If the wall is moving as well or at different rotations/angles this is indeed not very suitable for ColAndreas.
Reply
#8

Well, all you need to do is create a collision object in colandreas at your moveobject position do the raycast then delete the object pretty easy.

You only need to update anything when you need to do checks.


https://github.com/Pottus/ColAndreas...a_createobject
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)