Page 1 of 1

Collision problems with ConvexHulls and StaticMeshes

Posted: Sat Feb 25, 2012 5:01 pm
by al9191
In the game, the world is made up of obstacles which are StaticMeshes created from FBX model files, these are static objects.
The enemies and the player are ConvexHulls created from FBX model files, these are dynamic objects.

At the moment, as the player if you move into an enemy it pushes them out of the way, however, if you move into one of the obstacles, the player's ConvexHull "pushes" through the obstacle, which "messes" it up as it ends up with the player's character (a ship-like thing) to be point slightly to the floor and so controls then mess up (as the player can only move/rotate in x and z directions and so is fixed to floor and cannot look up and down. Therefore, it being tipped slightly messes up the controls.
If you sit next to an obstacle and then rotate round the edge of the player's ship can go into the obstacle and so when it rotates round it moves vertically up the obstacle ending up in the air before moving away to fall back to the floor.

I cannot work out why the player can move through the obstacle StaticMeshes instead of being pushed off them like you are when you push into enemies. And why the collisions don't seem to be working properly.

Any ideas what could be causing it?

Re: Collision problems with ConvexHulls and StaticMeshes

Posted: Sat Feb 25, 2012 9:14 pm
by Norbo
It sounds like the player is being controlled extremely rigidly. I believe you said in earlier posts that it does not do any Position/Orientation setting to move, but extremely large impulses can cause issues as well by interfering with collision response.

I would suggest trying to 'weaken' any motors or control systems which are working on the ship. If it's using BEPUphysics motors, there are spring settings which can be explicitly weakened. Other forms of control will need to be weakened on a case-by-case basis.

Unfortunately I don't quite have enough information to diagnose the problem precisely. A runnable/debuggable project or demo showing the issue would be very helpful to me in finding what exactly needs changing.

Re: Collision problems with ConvexHulls and StaticMeshes

Posted: Sat Mar 17, 2012 1:19 pm
by al9191
Weakening the settings for the motors and servos attached to the player's ship, (other than making it not turn fast enough) does not alter the collision problem, it still can go inside the static obstacles and it causes the player to rotate in really weird way. Leaving the orientation of the ship "messed up".
Even taking the servo out that rotates it completely, and it still behaves the same when it collides.

Why can it go inside the StaticObject at all?


*EDIT*

Never mind, I tried making the LinearAxisMotor attached for movement softer by putting the softness property up and it now works perfectly. Thanks for the help.

Re: Collision problems with ConvexHulls and StaticMeshes

Posted: Sat Mar 17, 2012 7:32 pm
by Norbo
Why can it go inside the StaticObject at all?
Constraints, by default, are very rigid. They don't want to be violated and will apply massive forces in pursuit of that goal. An unstoppable force versus an immovable object, in other words.

Contacts are collision constraints that seek to avoid penetration. When put up against another constraint willing to apply immense forces, the solver will try its best to come to a reasonable solution, but it's very difficult. For performance, the solver stops after 10 iterations by default (Space.Solver.IterationLimit), meaning it can't continue to converge to a more correct state forever. The result is one of the constraints usually ends up losing the fight and wonky things can occur. The immense forces can also feed back into other systems, interfering with contact manifold maintenance and triggering jitter which exacerbates the issue.

Increasing a motor's softness allows the constraint to be violated more, as you've seen. A soft constraint pressed up against the rigid contact constraint will lose quickly and reliably, preventing any solver difficulties.

Re: Collision problems with ConvexHulls and StaticMeshes

Posted: Sun Mar 18, 2012 11:06 am
by al9191
Ok thanks very much, I can see why it works now. :).