From 2a214f5305af0d9578155a15f25b0022684de651 Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Wed, 12 Feb 2014 10:31:50 +0100 Subject: [PATCH] Added cone to apply effect --- .../Implementation/PhysicsAPI_Impl.cpp | 15 ++++++++------- Code/OysterPhysics3D/Cone.h | 1 - Code/OysterPhysics3D/OysterCollision3D.h | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp b/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp index 4d58a15b..820688a5 100644 --- a/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp +++ b/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp @@ -262,6 +262,7 @@ void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void* Sphere* sphere; Box* box; + Cone* cone; switch(collideable->type) { @@ -293,19 +294,19 @@ void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void* break; - //case ICollideable::Type::Type_cone: - //cone = dynamic_cast(collideable); + case ICollideable::Type::Type_cone: + cone = dynamic_cast(collideable); // Add collision shape - //shape = new btConeShape(); + shape = new btConeShape(cone->radius, cone->height.GetLength()); // Add motion state - //state = new btDefaultMotionState(btTransform(btQuaternion(),btVector3(cone->center.x, cone->center.y, cone->center.z))); + state = new btDefaultMotionState(btTransform(btQuaternion(btVector3(cone->height.x, cone->height.y, cone->height.z).normalized(), 0.0f),btVector3(cone->position.x, cone->position.y, cone->position.z))); // Add rigid body - //btRigidBody::btRigidBodyConstructionInfo rigidBodyCI(0, state, shape); - //body = new btRigidBody(rigidBodyCI); + rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, state, shape); + body = new btRigidBody(rigidBodyCI); - //break; + break; default: return; } diff --git a/Code/OysterPhysics3D/Cone.h b/Code/OysterPhysics3D/Cone.h index 533a1b9c..0c12201a 100644 --- a/Code/OysterPhysics3D/Cone.h +++ b/Code/OysterPhysics3D/Cone.h @@ -25,7 +25,6 @@ namespace Oyster Cone & operator = ( const Cone &Cone ); - private: Oyster::Math::Float3 height; Oyster::Math::Float3 position; Oyster::Math::Float radius; diff --git a/Code/OysterPhysics3D/OysterCollision3D.h b/Code/OysterPhysics3D/OysterCollision3D.h index 83a6239e..3b1e589f 100644 --- a/Code/OysterPhysics3D/OysterCollision3D.h +++ b/Code/OysterPhysics3D/OysterCollision3D.h @@ -17,6 +17,7 @@ #include "Box.h" #include "Frustrum.h" #include "Line.h" +#include "Cone.h" namespace Oyster { namespace Collision3D { namespace Utility {