Soldat Fans > Developers Corner

[Question] Soldat wall/collision detection

(1/1)

mre521:
Hey, I was wondering... How does soldat detect if something hits a wall, or if there is a wall(s) between two points(line)?

I would assume that for collision detection it would just be a line made from an objects position and it's projected position based on velocity, then wall detection for that line.

I know that you technically could make a linear equation for each wall line and for the collision line then solve for an intersection, but wouldn't that be slow since you have to do at least 2 lines of every poly for every object on screen?

I'm just curious of how it works.

Fryer:
When you compile a map the map editor (Soldat PolyWorks) splits the map into several subsections. It then adds the polygons in the map to the lists for each subsection, so that every subsection has a list of polygons inside it.

When you are playing the game it checks the list of polygons for the section that the player is currently moving through. It then performs collision detection on only those polygons, which makes it faster than having to check all polygons in the whole map. :P

The collision detection in Soldat right now is far from perfect though, which is why you can at some points get boosted through walls if they are too small or even get stuck inside a bunch of polygons.

mre521:
But how does it actually do the poly intersection checks? I already knew that the maps were split into sectors.

Falcon`:
It just check every tick (1/60 of second) what's your position and velocity and if that makes you collide with any polygon in current sector.

Fryer:
It's a bit messy actually; it checks if several points of the body are inside a polygon, then after that it checks if any of the polygons vertices are colliding with the player or something like that. So it's messier than it needs to be, and on top of that some of the calculations are done in the wrong way, which is why polygons have the ability to bounce players to great speeds if they are placed in a certain way.

Navigation

[0] Message Index

Go to full version