FlingEngine icon indicating copy to clipboard operation
FlingEngine copied to clipboard

Integrate bullet physics

Open ArturoKuang opened this issue 5 years ago • 1 comments

Integrate bullet physics with our entity component system. https://github.com/bulletphysics/bullet3

Basic rough draft of the physic system

// Add a 3D rigidbody component
entt::entitty e = reg.create();
Rigidbody& c = reg.assign<Rigidbody>(e, transform, force, velocity, acceleration, mass, etc....);

// Add collision body component for collision detection
entt::entitty e = reg.create();
SphereCollider& c = reg.assign<SphereCollider>(e, transform, radius);

// Add 
entt::entitty e = reg.create();
Transform& c = reg.assign<Transform>(e, Transform{});
Rigidbody& c = reg.assign<Rigidbody>(e, transform, force, velocity, acceleration, mass, etc....);
SphereCollider& c = reg.assign<SphereCollider>(e, transform, radius);

class PhysicSystem
{
   // Update all active physics component
   void Update(entt::registry reg);
};

ArturoKuang avatar Oct 13 '19 01:10 ArturoKuang

That outline looks good. This article explains how we can make relationships with Entt: https://skypjack.github.io/2019-04-12-entt-tips-and-tricks-part-1/

(i.e. rigidbody HAS A transform)

BenjaFriend avatar Oct 14 '19 19:10 BenjaFriend