Girona game engine in blender
Posted: Sun Aug 28, 2005 11:55 am
Hi, i'm making progress with my own game engine inside blender. I'm using bullet for it, and i'm having some issues to solve. The latest info and shots from the tests are in:
http://www.blender.org/forum/viewtopic. ... 2558#42558
My problem is that i have a dynamic platform that i controll using the keyboard to inclinate it. On this platform there is an object spinning around. When i set the new position of the platform, sometimes it penetrates the object, and makes it jump high, or even fall through.
I'm not sure of the right way to do this, i've implemented myself the following code:
Bcause i was using the first version of blender with bullet. maybe it is working better now. I should probably update, but as ie branched some files, it requires some work.
Also, i'm calling the update on the physics engine once per frame, and i suppose this has to be more complex than this... My main loop looks like:
in the logic pipelines i update the position due to user interaction.
(bandoler)
http://www.blender.org/forum/viewtopic. ... 2558#42558
My problem is that i have a dynamic platform that i controll using the keyboard to inclinate it. On this platform there is an object spinning around. When i set the new position of the platform, sometimes it penetrates the object, and makes it jump high, or even fall through.
I'm not sure of the right way to do this, i've implemented myself the following code:
Code: Select all
void CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)
{
// added by bandoler. don't trust this
SimdTransform xform = m_body->getCenterOfMassTransform();
xform.setRotation( SimdQuaternion(quatImag0,quatImag1,quatImag2,quatReal) );
this->m_body->setCenterOfMassTransform(xform);
}
void CcdPhysicsController::setPosition(float posX,float posY,float posZ)
{
// added by bandoler. don't trust this
SimdTransform xform = m_body->getCenterOfMassTransform();
xform.setOrigin( SimdVector3(posX,posY,posZ) );
this->m_body->setCenterOfMassTransform(xform);
}
Also, i'm calling the update on the physics engine once per frame, and i suppose this has to be more complex than this... My main loop looks like:
Code: Select all
while (!lExit)
{
double lCurrentTime = PIL_check_seconds_timer();
double lDeltaTime = lCurrentTime - lLastTime;
lLastTime = lCurrentTime;
// Process events
lExit = lEngine->ProcessEvents();
// Process logic pipelines
for ( unsigned int i=0;i<lLogicPipelines.size(); i++ )
lLogicPipelines[i]->Run();
// Run the physics
lEngine->iPhysicsEnvironment->beginFrame();
lEngine->iPhysicsEnvironment->proceedDeltaTime( lCurrentTime, lDeltaTime );
lEngine->iPhysicsEnvironment->endFrame();
// Run the graphics pipeline
get_render_pipeline()->Run();
}
(bandoler)