Page 1 of 1

Ogre and bullet implementation

Posted: Mon Mar 28, 2016 9:50 am
by Typhontaur

Re: Ogre and bullet implementation

Posted: Wed Mar 30, 2016 3:58 am
by hyyou
Here is my an subjective and arguable propose ...

You should have to be able to do basic things in both engine BEFORE try to integrate them.

The basic things :-
  • Ogre3d = camera, light, entity and sceneNode.
    Bullet = dynamic world, (set/get) (velocity, position), rigidbody (simple shape like plane & cube)
Binding two engines is basically just get location & orientation from btRigidBody and set to the sceneNode of Ogre3D.

It is not hard to make it happen, but for me it is really hard to make the code not messy and usable as an utility for game.

I recommends to encapsulate both engines, at least their basic features.

Re: .

Posted: Thu May 05, 2016 6:12 pm
by benelot
Whatever the original question was (I can guess based on the answer). I wrote a simulator based on Ogre3D and Bullet without using OgreBullet. If you need directions on how to do that, ask me anything!

Re: .

Posted: Wed Jul 13, 2016 3:28 am
by hyyou
Benelot, in your top level of program, how you encapsulate Bullet Engine?

I am creating physic object like this :-

Code: Select all

MyRigidBody* rigid = physicFactory()->createCube( position, halfSize , mass, mask );
My bullet world is encapsulated in Physic_Room that has a duty to maintain each type of physic object.
I create a custom array to store each type of them (constraint , rigid, compound, empty ).
I have to code function for allocate new physic object of each type.

Code: Select all

class Physic_Room{
     MyConstraint* allocateConstraint(){   ....     }
     MyRigidBody* allocateRigidbody(){   ....     }
     ...
     void addToTheBulletWorld(MyConstraint*){   ....     }
     void addToTheBulletWorld(MyRigidBody*){   ....     }
     ...
     void destroyConstraint(MyConstraint*){   ....     }
     void destroyRigidBody(MyRigidBody*){   ....     }
     ...
};
I think it is error-prone.
Would you mind to share how you did?

Re: .

Posted: Fri Jul 29, 2016 10:25 pm
by benelot
So basically I created a model view controller pattern, having an environment encapsulating the world, creature consisting of limbs encapsulating rigidbodies, joints encapsulating joint constraints. Each controller class then reads the model state from the physics and updates its view to represent the state. Your physics room would be similar to my environment, except that I would store creatures in a std::vector instead of storing all things separately.

This is what this generally looks like:
-A single limb:
https://github.com/benelot/minemonics/b ... y/Limb.cpp

https://github.com/benelot/minemonics/b ... y/Limb.hpp

A creature (consisting of a phenotype which in turn consists of limbs and joints):

https://github.com/benelot/minemonics/b ... eature.cpp

https://github.com/benelot/minemonics/b ... eature.hpp