Walking through walls collision problem

Blitz3D Forums/Blitz3D Programming/Walking through walls collision problem

ringwraith(Posted 2008) [#1]
What I have is a house which is set to collide with a character by ellipsoid-to-polygon mode with a full sliding response. The problem is that the collisions don't appear to work some of the time. For example, my character can run across the floor and when he runs into the walls he usually stops, but sometimes if I hit the wall at a certain speed and angle my character just goes right through. This only occurs in certain places on the wall. I know it doesn't have to do with the radius of my character because no matter how I adjust that the problem is still there. This isn't a problem when I set the collisions to 'stop' response, but when I do this a different problem arises which is that my character can't even move when he's in the house. I've thought of dividing the house into two separate parts, the walls and the floors, and having the walls trigger a stop response and the floors trigger a sliding response, but this would involve going through every building model and separating the walls from the floor, which would be quite painstaking and laborious.So, can anyone think of a better solution to this problem or at least explain why this might be happening?


Stevie G(Posted 2008) [#2]
A couple of things you may want to try ..

If the house is comprised of several meshes - make sure you set the collisions for the children.

You may have small gaps in your mesh in the places that collisions are breaking during slide mode. This can cause this issue. Examine the house in more detail at a bigger scale.

If you say using stop collisions works - try backing up your player slightly when a collision occurs and see how this works ..

for c = 1 to countcollisions( player )
translateentity player, collisionnx( player, c ) * .01, collisionny( player,c ) * .01, collisionnz( player, c ) * .01
next

Stevie


ringwraith(Posted 2008) [#3]
Wait, scratch that, I've just been playing around with it for awhile and it's still a problem when the response is set to stop. Stevie, it's just one single mesh, so it doesn't have to do with children not being set to collide. Also, I tried your suggestion about using the collision normals, which seems to work when I do it like this (multiplying by player speed instead of 0.01):

for c = 1 to countcollisions( player )
translateentity player, collisionnx( player, c ) * playerspeed, collisionny( player,c ) * playerspeed, collisionnz( player, c ) * playerspeed
next

The only problem is that this results in a bounce back effect every time the player hits the wall. Also, I tried experimenting with different numbers but anything less than the players speed resulted in the player being able to go through the wall. I don't understand why this would be happening in the first place. Isn't Blitz supposed to handle the collisions?


Stevie G(Posted 2008) [#4]
Can you post some code or e-mail it to me? Blitz collisions work just fine.


MadJack(Posted 2008) [#5]
How far are your models from 0,0,0?

I seem to recall that high distances can introduce floating point errors to the collision calculations and occasional failures...


ringwraith(Posted 2008) [#6]
Wow Madjack, you really nailed it on the head. My house and player were located at 90000,0,90000 for some odd reason. When I moved them closer to the origin (900,0,900) the collisions started working perfectly.

Thanks for finding the problem for me :) and thanks for your help, too, Steve.


MadJack(Posted 2008) [#7]
Cool - one of the issues when trying to build large seamless worlds I suppose.

My own levels are limited to 4096x2048x4096 - I found that anything larger could lead to rare failures (e.g. characters falling through a mesh) and although it's probably not going to be a problem for you, collisions of medium/small polys against very large single polys can cause failures as well.


ringwraith(Posted 2008) [#8]
Thanks, I'll have to keep that in mind.