Public Group

# Need Help Implementing a Global Collision System

This topic is 607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've been playing around with collision detection methods for my game and have become interested in seeing how one would implement a collision system separate from the movement logic. A lot of collision systems I see depend on the object storing its future position after moving and checking if that future position collides with the map and modifying that position accordingly before finally moving to that new position.

However, I know that some games separate the collision logic from the movement logic so the object just moves to its future position and instead a separate global system loops through objects and handles collision itself. Does anyone know how I could go about implementing this type of system?

##### Share on other sites

Would this separation of movement and collision logic also prevent objects from communicating their intent of moving to the collision system?

If that is not the case, you could queue every intent of object moving to the collision system which would check the destination coordinates against the restricted set and return a go-ahead or a reasonable replacement destination.

##### Share on other sites

Would this separation of movement and collision logic also prevent objects from communicating their intent of moving to the collision system?

If that is not the case, you could queue every intent of object moving to the collision system which would check the destination coordinates against the restricted set and return a go-ahead or a reasonable replacement destination.

I see how that could work. Would being able to check the velocity in the collision system be an example of the collision system knowing whether the object intends to move work? Also, would there be a need to ensure that the collision system ticks at a certain rate relative to the object? Or is it ok if the collision system ticks at a different rate from the object?

##### Share on other sites

Would this separation of movement and collision logic also prevent objects from communicating their intent of moving to the collision system?

If that is not the case, you could queue every intent of object moving to the collision system which would check the destination coordinates against the restricted set and return a go-ahead or a reasonable replacement destination.

I see how that could work. Would being able to check the velocity in the collision system be an example of the collision system knowing whether the object intends to move work? Also, would there be a need to ensure that the collision system ticks at a certain rate relative to the object? Or is it ok if the collision system ticks at a different rate from the object?

For the first part I'd say that would be a bad practice if the number of objects grows. You would have to keep track of every object that can move and check it's velocity every tick to figure out whether you have to do anything to it or not. These loops would probably slow down your performance. What I would suggest is more of a trigger system or an event based system where an objects that wants to move triggers an event which tells the collision system the next time it ticks to take action on the object that triggered the event. Which pretty much also answers your second part of the question. Events can even be triggered by objects on other threads so no you don't need syncronous ticks.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
A4L
12
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013738
×