Physics questions

Hello again.

Can you give an advice about current implementation?

My planned game needs following features

  • Spherical and (ideally) convex hull (but AABBox will work too) collisions. Is it possible?

  • Disable gravity completely. It seems like current API properties are overlapping in some kind. What is right way to do so?

  • For RigidBodies, Ability to set Mass, apply Force, and if possible, Torqe. But it seems like underlying Krafts’ RB object is hidden in private part of wrapper. Of course I can patch source (what I don’t like) and make it visible, but I still like to use CGE’s collisions handlers.

Spherical and (ideally) convex hull (but AABBox will work too) collisions. Is it possible?

Sure. We support plane, sphere, box, mesh (convex or not) colliders. See the descendants of TCollider in “Class Hierarchy” in API docs: Castle Game Engine: Class Hierarchy,

TCollider

Their demos are inside castle-engine/examples/physics at master · castle-engine/castle-engine · GitHub , you probably saw these already :slight_smile:

Disable gravity completely. It seems like current API properties are overlapping in some kind. What is right way to do so?

For rigid body objects, set MyRigidBody.Gravity := false. For camera (in you make first-person view game) set SceneManager.WalkCamera.Gravity := false (or just SceneManager.NavigationType := ntFly).

Do not touch TCastleTransform.Gravity (which is false by default) if you use physics. It will be deprecated soon.

The reason for some differences is that “camera vs world” collisions are right now not performed using the physics engine, instead they use internal CGE (outside of physics engine) collision structures. It will be unified at some point of course.

For RigidBodies, Ability to set Mass, apply Force, and if possible, Torqe. But it seems like underlying Krafts’ RB object is hidden in private part of wrapper. Of course I can patch source (what I don’t like) and make it visible, but I still like to use CGE’s collisions handlers.

TCollider ( Castle Game Engine: CastleTransform: Class TCollider ) has mass.

As it happens, Andrzej Kilijański works right now on exposing some more properties from Kraft. The PR is on KraftRigidBody lifetime fix and expose some methods (WIP) by and3md · Pull Request #118 · castle-engine/castle-engine · GitHub , and I will merge it in an ~hour because I see that everything is now perfect :slight_smile: In general, in such cases, we want to extend CGE API to expose the useful properties from Kraft – it takes more time, but should result in a clean API this way.