Merge remote-tracking branch 'origin/GamePhysics' into GameLogic
This commit is contained in:
commit
26a6bde42a
|
@ -297,10 +297,10 @@ void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void*
|
|||
case ICollideable::Type::Type_cone:
|
||||
cone = dynamic_cast<Cone*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btConeShape(cone->radius, cone->height.GetLength());
|
||||
shape = new btConeShapeZ(cone->radius, cone->length);
|
||||
|
||||
// Add motion state
|
||||
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)));
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(cone->quaternion.x, cone->quaternion.y, cone->quaternion.z, cone->quaternion.w),btVector3(cone->center.x, cone->center.y, cone->center.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, state, shape);
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Oyster
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(colObj1->m_collisionObject == &body && "Body does not match either collision object");
|
||||
//assert(colObj1->m_collisionObject == &body && "Body does not match either collision object");
|
||||
pt = cp.m_localPointB;
|
||||
this->func((ICustomBody*)(colObj0->getCollisionObject()->getUserPointer()), this->args);
|
||||
}
|
||||
|
|
|
@ -11,22 +11,36 @@ using namespace ::Oyster::Math3D;
|
|||
|
||||
Cone::Cone( ) : ICollideable(Type_cone)
|
||||
{
|
||||
this->center = Float3(0, 0, 0);
|
||||
this->quaternion = Float4(0, 0, 0, 1);
|
||||
this->radius = 1;
|
||||
this->height = Oyster::Math::Float3(0,0,0);
|
||||
this->length = 0;
|
||||
}
|
||||
|
||||
Cone::Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||
Cone & Cone::operator = ( const Cone &Cone )
|
||||
{
|
||||
this->radius = radius;
|
||||
this->height = height;
|
||||
this->position = position;
|
||||
this->center = Cone.center;
|
||||
this->quaternion = Cone.quaternion;
|
||||
this->radius = Cone.radius;
|
||||
this->length = Cone.length;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Cone::Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||
Cone::Cone( const ::Oyster::Math::Float &height, const Oyster::Math::Float3 &position, const Oyster::Math::Float4 &quaternion, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||
{
|
||||
this->center = position;
|
||||
this->quaternion = quaternion;
|
||||
this->radius = radius;
|
||||
this->height = (Oyster::Math::Float3)height;
|
||||
this->position = (Oyster::Math::Float3)position;
|
||||
this->length = height;
|
||||
}
|
||||
|
||||
Cone::Cone( const ::Oyster::Math::Float &height, const Oyster::Math::Float4 &position, const Oyster::Math::Float4 &quaternion, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||
{
|
||||
this->center = position;
|
||||
this->quaternion = quaternion;
|
||||
this->radius = radius;
|
||||
this->length = height;
|
||||
}
|
||||
|
||||
Cone::~Cone( )
|
||||
|
@ -34,14 +48,6 @@ Cone::~Cone( )
|
|||
|
||||
}
|
||||
|
||||
Cone & Cone::operator = ( const Cone &cone )
|
||||
{
|
||||
this->radius = cone.radius;
|
||||
this->height = cone.height;
|
||||
this->position = cone.position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> Cone::Clone( ) const
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Cone(*this) );
|
||||
|
|
|
@ -18,9 +18,15 @@ namespace Oyster
|
|||
{
|
||||
public:
|
||||
|
||||
union
|
||||
{
|
||||
struct{ ::Oyster::Math::Float3 center; ::Oyster::Math::Float4 quaternion; ::Oyster::Math::Float radius; ::Oyster::Math::Float length; };
|
||||
char byte[sizeof(::Oyster::Math::Float3) + sizeof(::Oyster::Math::Float4) + sizeof(::Oyster::Math::Float) + sizeof(::Oyster::Math::Float)];
|
||||
};
|
||||
|
||||
Cone();
|
||||
Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius );
|
||||
Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius );
|
||||
Cone( const ::Oyster::Math::Float &height, const Oyster::Math::Float3 &position, const Oyster::Math::Float4 &quaternion, const ::Oyster::Math::Float &radius );
|
||||
Cone( const ::Oyster::Math::Float &height, const Oyster::Math::Float4 &position, const Oyster::Math::Float4 &quaternion, const ::Oyster::Math::Float &radius );
|
||||
virtual ~Cone( );
|
||||
|
||||
Cone & operator = ( const Cone &Cone );
|
||||
|
@ -32,11 +38,6 @@ namespace Oyster
|
|||
bool Contains( const ICollideable &target ) const{return false;};
|
||||
|
||||
::Oyster::Math::Float TimeOfContact( const ICollideable &deuterStart, const ICollideable &deuterEnd ) const{return 0;};
|
||||
|
||||
|
||||
Oyster::Math::Float3 height;
|
||||
Oyster::Math::Float3 position;
|
||||
Oyster::Math::Float radius;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue