From bdda7af8d7cd74fff36a556cfdc60894b2b9058e Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Sat, 27 Oct 2018 11:38:38 -0700 Subject: [PATCH] Use the kF_UseGjkConvexCastRaytest for more accurate picking fix upAxis in some demos --- examples/CommonInterfaces/CommonGraphicsAppInterface.h | 4 ++-- examples/CommonInterfaces/CommonRigidBodyBase.h | 2 ++ examples/OpenGLWindow/SimpleOpenGL3App.cpp | 2 +- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/CommonInterfaces/CommonGraphicsAppInterface.h b/examples/CommonInterfaces/CommonGraphicsAppInterface.h index c34ead64b..cd821da1f 100644 --- a/examples/CommonInterfaces/CommonGraphicsAppInterface.h +++ b/examples/CommonInterfaces/CommonGraphicsAppInterface.h @@ -13,10 +13,10 @@ struct DrawGridData int upAxis; float gridColor[4]; - DrawGridData(int upAxis = 1) + DrawGridData(int upAx = 1) : gridSize(10), upOffset(0.001f), - upAxis(upAxis) + upAxis(upAx) { gridColor[0] = 0.6f; gridColor[1] = 0.6f; diff --git a/examples/CommonInterfaces/CommonRigidBodyBase.h b/examples/CommonInterfaces/CommonRigidBodyBase.h index 05e8f2504..09f8b57d3 100644 --- a/examples/CommonInterfaces/CommonRigidBodyBase.h +++ b/examples/CommonInterfaces/CommonRigidBodyBase.h @@ -10,6 +10,7 @@ #include "CommonGraphicsAppInterface.h" #include "CommonWindowInterface.h" +#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h" struct CommonRigidBodyBase : public CommonExampleInterface { @@ -317,6 +318,7 @@ struct CommonRigidBodyBase : public CommonExampleInterface btCollisionWorld::ClosestRayResultCallback rayCallback(rayFromWorld, rayToWorld); + rayCallback.m_flags |= btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest; m_dynamicsWorld->rayTest(rayFromWorld, rayToWorld, rayCallback); if (rayCallback.hasHit()) { diff --git a/examples/OpenGLWindow/SimpleOpenGL3App.cpp b/examples/OpenGLWindow/SimpleOpenGL3App.cpp index baa607bef..d3176cfe5 100644 --- a/examples/OpenGLWindow/SimpleOpenGL3App.cpp +++ b/examples/OpenGLWindow/SimpleOpenGL3App.cpp @@ -78,7 +78,7 @@ struct SimpleInternalData m_ffmpegFile(0), m_renderTexture(0), m_userPointer(0), - m_upAxis(0), + m_upAxis(1), m_customViewPortWidth(-1), m_customViewPortHeight(-1) { diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 651dde11b..1f4242cb9 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -10753,6 +10753,7 @@ bool PhysicsServerCommandProcessor::pickBody(const btVector3& rayFromWorld, cons //btCollisionWorld::ClosestRayResultCallback rayCallback(rayFromWorld, rayToWorld); MyResultCallback rayCallback(rayFromWorld, rayToWorld); + rayCallback.m_flags |= btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest; m_data->m_dynamicsWorld->rayTest(rayFromWorld, rayToWorld, rayCallback); if (rayCallback.hasHit()) {