more cmake support for examples

This commit is contained in:
erwincoumans
2015-04-16 22:14:27 -07:00
parent c99ac6cfa1
commit ad8f705bcb
9 changed files with 152 additions and 125 deletions

View File

@@ -9,12 +9,12 @@ LINK_LIBRARIES(
)
IF (WIN32)
ADD_EXECUTABLE(AppHelloWorld
ADD_EXECUTABLE(App_HelloWorld
HelloWorld.cpp
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
)
ELSE()
ADD_EXECUTABLE(AppHelloWorld
ADD_EXECUTABLE(App_HelloWorld
HelloWorld.cpp
)
ENDIF()
@@ -23,7 +23,7 @@ ENDIF()
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
SET_TARGET_PROPERTIES(AppHelloWorld PROPERTIES DEBUG_POSTFIX "_Debug")
SET_TARGET_PROPERTIES(AppHelloWorld PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
SET_TARGET_PROPERTIES(AppHelloWorld PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
SET_TARGET_PROPERTIES(App_HelloWorld PROPERTIES DEBUG_POSTFIX "_Debug")
SET_TARGET_PROPERTIES(App_HelloWorld PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
SET_TARGET_PROPERTIES(App_HelloWorld PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)

View File

@@ -16,6 +16,7 @@ subject to the following restrictions:
///-----includes_start-----
#include "btBulletDynamicsCommon.h"
#include <stdio.h>
#include <conio.h>
/// This is a Hello World program for running a basic Bullet physics simulation
@@ -122,12 +123,16 @@ int main(int argc, char** argv)
{
btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[j];
btRigidBody* body = btRigidBody::upcast(obj);
btTransform trans;
if (body && body->getMotionState())
{
btTransform trans;
body->getMotionState()->getWorldTransform(trans);
printf("world pos = %f,%f,%f\n",float(trans.getOrigin().getX()),float(trans.getOrigin().getY()),float(trans.getOrigin().getZ()));
} else
{
trans = obj->getWorldTransform();
}
printf("world pos object %d = %f,%f,%f\n",j,float(trans.getOrigin().getX()),float(trans.getOrigin().getY()),float(trans.getOrigin().getZ()));
}
}
@@ -176,5 +181,7 @@ int main(int argc, char** argv)
collisionShapes.clear();
///-----cleanup_end-----
printf("Press a key to exit\n");
getch();
}