saharan / OimoPhysics

A cross-platform 3D physics engine
MIT License
863 stars 68 forks source link

add ghost rigid body feature #45

Open saharan opened 2 years ago

saharan commented 2 years ago

related to #34 just giving callbacks with no physical affection

lo-th commented 2 years ago

Hi, how do we do ? any example ?

Dev-MarkoF commented 2 years ago

I added in in my specific fork that i created for a university game engine i help building. It's a very basic integration of the feature, but it does add a triggerEnter/triggerExit state, that is firing a usable event, similar to the existing collision events, and it's based on the shape of the trigger, so it works with any convex meshes.

The feature is independent of bodyType or group, any rigidybody can be a trigger by setting the isTrigger flag on it.

Currently working on a terrain integration, but i'm kinda stuck and need to understand the basic of the oimo engine better. Adding triggers was doable with just a few lines of code, biggest problem was to make it so that, you get all points of contact returned as if it does collide but then do not further process them, in the correct way, so the standard collision is not interfered by this.

https://github.com/Dev-MarkoF/OimoPhysics (I forked from the adapting Haxe 4.0 Dev Branch and applied most of the fixes saharan later used in the merger to master myself, but i'm an adept in physics programming, so the implementation of ghost bodies / trigger is just slapped in)

Geequlim commented 2 years ago

Any progress about this?