Girona game engine in blender

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
bandoler
Posts: 4
Joined: Thu Jul 07, 2005 8:39 am

Girona game engine in blender

Post by bandoler »

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:

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);
}
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:

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();
		
	}
in the logic pipelines i update the position due to user interaction.

(bandoler)