AnswerBun.com

Rigid body falls through static mesh even though collision is detected

Game Development Asked by Grimelios on September 18, 2020

I’m using Jitter Physics to create a game. For testing, I have ball (a spherical rigid body) falling onto a small box-like mesh. The problem is that the ball falls straight through the floor, even though the collision seems to be detected properly.

Ball (spherical rigid body) falling onto a custom mesh.

The mesh’s rigid body is created using a triangle mesh shape. In the code below, model is the floor’s 3D model

Octree octree = PhysicsUtilities.ExtractOctree(model);
octree.BuildOctree();

Body body = new RigidBody(new TriangleMeshShape(octree));
body.IsStatic = true;

The PhysicsUtilities.ExtractOctree function extracts vertices from the 3D model in order to create the rigid body. As far as I can tell, that function is working correctly (i.e. all vertices and indices look correct). To check if the collision was detected, I added a callback function as follows.

CollisionSystem collisionSystem = new CollisionSystemSAP();
collisionSystem.CollisionDetected += OnCollisionDetected;

World world = new World(collisionSystem);

The ball-floor collision is detected and everything about the collision looks correct. I’ve even tried changing values in world.ContactSettings, but nothing worked.

Has anyone else experienced this problem? I’ve tried everything I can and Jitter’s documentation is pretty low.

One Answer

Collision detection has very little to do with collision response, besides triggering it.

Check your settings for both bodies, and the settings for the physics system:

  1. Collision callbacks: Is there a collision behaviour for each body?
  2. Body density: if density is too low, objects float through each other.
  3. Mass: physics needs this to compute kinematic response and normal forces. make sure the value is set.

Answered by Ian Young on September 18, 2020

Add your own answers!

Related Questions

Resizing a tiledmap when using phaser

1  Asked on December 16, 2020 by sora

   

Prefab spawning issue

2  Asked on December 15, 2020 by usmaan-mahmood

   

Pause updating but keep rendering

1  Asked on December 5, 2020 by yosoku-denkai

     

How to make it so my cursor is not behind the UI?

0  Asked on December 3, 2020 by jacksonba90

   

Can’t submit facebook app for review

2  Asked on November 20, 2020 by moria

   

OpenGL Strange mesh when animating Assimp

1  Asked on October 26, 2020 by david-neves

     

2D Sidescroller Gravity

1  Asked on October 22, 2020 by pete-mavrelis

     

Can I “unmerge” merged meshes UE4?

0  Asked on September 22, 2020 by formatc2013

   

unity : How to delete unused assets?

0  Asked on September 6, 2020 by andio

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir