fix Lua example
This commit is contained in:
@@ -30,6 +30,9 @@
|
||||
#include "../FractureDemo/FractureDemo.h"
|
||||
#include "../DynamicControlDemo/MotorDemo.h"
|
||||
#include "../RollingFrictionDemo/RollingFrictionDemo.h"
|
||||
#ifdef ENABLE_LUA
|
||||
#include "../LuaDemo/LuaPhysicsSetup.h"
|
||||
#endif
|
||||
|
||||
#ifdef B3_USE_CLEW
|
||||
#ifndef NO_OPENGL3
|
||||
@@ -174,7 +177,10 @@ static ExampleEntry gDefaultExamples[]=
|
||||
|
||||
|
||||
ExampleEntry(0,"Experiments"),
|
||||
|
||||
#ifdef ENABLE_LUA
|
||||
ExampleEntry(1,"Lua Script", "Create the dynamics world, collision shapes and rigid bodies using Lua scripting",
|
||||
LuaDemoCreateFunc),
|
||||
#endif
|
||||
ExampleEntry(1,"Voronoi Fracture", "Automatically create a compound rigid body using voronoi tesselation. Individual parts are modeled as rigid bodies using a btConvexHullShape.",
|
||||
VoronoiFractureCreateFunc),
|
||||
|
||||
|
||||
@@ -166,15 +166,18 @@ void OpenGLGuiHelper::createRigidBodyGraphicsObject(btRigidBody* body, const btV
|
||||
|
||||
void OpenGLGuiHelper::createCollisionObjectGraphicsObject(btCollisionObject* body, const btVector3& color)
|
||||
{
|
||||
btCollisionShape* shape = body->getCollisionShape();
|
||||
btTransform startTransform = body->getWorldTransform();
|
||||
int graphicsShapeId = shape->getUserIndex();
|
||||
if (graphicsShapeId>=0)
|
||||
if (body->getUserIndex()<0)
|
||||
{
|
||||
// btAssert(graphicsShapeId >= 0);
|
||||
btVector3 localScaling = shape->getLocalScaling();
|
||||
int graphicsInstanceId = m_data->m_glApp->m_renderer->registerGraphicsInstance(graphicsShapeId, startTransform.getOrigin(), startTransform.getRotation(), color, localScaling);
|
||||
body->setUserIndex(graphicsInstanceId);
|
||||
btCollisionShape* shape = body->getCollisionShape();
|
||||
btTransform startTransform = body->getWorldTransform();
|
||||
int graphicsShapeId = shape->getUserIndex();
|
||||
if (graphicsShapeId>=0)
|
||||
{
|
||||
// btAssert(graphicsShapeId >= 0);
|
||||
btVector3 localScaling = shape->getLocalScaling();
|
||||
int graphicsInstanceId = m_data->m_glApp->m_renderer->registerGraphicsInstance(graphicsShapeId, startTransform.getOrigin(), startTransform.getRotation(), color, localScaling);
|
||||
body->setUserIndex(graphicsInstanceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user