Added functionallity to stop collision responses
This commit is contained in:
parent
4ccf11b5d6
commit
1d3b073e7f
|
@ -22,12 +22,7 @@ namespace
|
||||||
Float4 worldPointOfContact;
|
Float4 worldPointOfContact;
|
||||||
if( proto->Intersects(*deuter, worldPointOfContact) )
|
if( proto->Intersects(*deuter, worldPointOfContact) )
|
||||||
{
|
{
|
||||||
switch( proto->CallSubscription_Collision(deuter) )
|
// Apply CollisionResponse in pure gather pattern
|
||||||
{
|
|
||||||
case ICustomBody::SubscriptMessage_ignore_collision_response:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{ // Apply CollisionResponse in pure gather pattern
|
|
||||||
ICustomBody::State protoState; proto->GetState( protoState );
|
ICustomBody::State protoState; proto->GetState( protoState );
|
||||||
ICustomBody::State deuterState; deuter->GetState( deuterState );
|
ICustomBody::State deuterState; deuter->GetState( deuterState );
|
||||||
|
|
||||||
|
@ -45,29 +40,32 @@ namespace
|
||||||
{
|
{
|
||||||
if( protoG_Magnitude >= deuterG_Magnitude )
|
if( protoG_Magnitude >= deuterG_Magnitude )
|
||||||
{
|
{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( deltaPos > 0.0f )
|
else if( deltaPos > 0.0f )
|
||||||
{
|
{
|
||||||
if( protoG_Magnitude <= deuterG_Magnitude )
|
if( protoG_Magnitude <= deuterG_Magnitude )
|
||||||
{
|
{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( proto->CallSubscription_BeforeCollisionResponse(proto) == ICustomBody::SubscriptMessage_ignore_collision_response )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// bounce
|
// bounce
|
||||||
Float4 bounceD = normal * -Formula::CollisionResponse::Bounce( deuterState.GetRestitutionCoeff(),
|
Float4 bounceD = normal * -Formula::CollisionResponse::Bounce( deuterState.GetRestitutionCoeff(),
|
||||||
deuterState.GetMass(), deuterG_Magnitude,
|
deuterState.GetMass(), deuterG_Magnitude,
|
||||||
protoState.GetMass(), protoG_Magnitude );
|
protoState.GetMass(), protoG_Magnitude );
|
||||||
|
|
||||||
//sumJ -= Formula::CollisionResponse::Friction( impulse, normal,
|
|
||||||
// protoState.GetLinearMomentum(), protoState.GetFrictionCoeff_Static(), protoState.GetFrictionCoeff_Kinetic(), protoState.GetMass(),
|
|
||||||
// deuterState.GetLinearMomentum(), deuterState.GetFrictionCoeff_Static(), deuterState.GetFrictionCoeff_Kinetic(), deuterState.GetMass());
|
|
||||||
|
|
||||||
// calc from perspective of proto
|
// calc from perspective of proto
|
||||||
proto->GetNormalAt( worldPointOfContact, normal );
|
proto->GetNormalAt( worldPointOfContact, normal );
|
||||||
|
@ -80,34 +78,15 @@ namespace
|
||||||
deuterState.GetMass(), deuterG_Magnitude );
|
deuterState.GetMass(), deuterG_Magnitude );
|
||||||
|
|
||||||
Float4 bounce = Average( bounceD, bounceP );
|
Float4 bounce = Average( bounceD, bounceP );
|
||||||
//Float4 bounce = bounceD + bounceP;
|
|
||||||
|
|
||||||
// FRICTION
|
|
||||||
// Apply
|
|
||||||
//sumJ += ( 1 / deuterState.GetMass() )*frictionImpulse;
|
|
||||||
// FRICTION END
|
|
||||||
|
|
||||||
// Float4 forwardedDeltaPos, forwardedDeltaAxis;
|
|
||||||
// { // @todo TODO: is this right?
|
|
||||||
// Float4 bounceAngularImpulse = ::Oyster::Math::Float4( (worldPointOfContact - protoState.GetCenterPosition()).xyz.Cross(bounce.xyz), 0.0f ),
|
|
||||||
// bounceLinearImpulse = bounce - bounceAngularImpulse;
|
|
||||||
// proto->Predict( forwardedDeltaPos, forwardedDeltaAxis, bounceLinearImpulse, bounceAngularImpulse, API_instance.GetFrameTimeLength() );
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
Float kineticEnergyPBefore = Oyster::Physics3D::Formula::LinearKineticEnergy( protoState.GetMass(), protoState.GetLinearMomentum()/protoState.GetMass() );
|
Float kineticEnergyPBefore = Oyster::Physics3D::Formula::LinearKineticEnergy( protoState.GetMass(), protoState.GetLinearMomentum()/protoState.GetMass() );
|
||||||
|
|
||||||
// protoState.ApplyForwarding( forwardedDeltaPos, forwardedDeltaAxis );
|
|
||||||
protoState.ApplyImpulse( bounce.xyz, worldPointOfContact.xyz, normal.xyz );
|
protoState.ApplyImpulse( bounce.xyz, worldPointOfContact.xyz, normal.xyz );
|
||||||
proto->SetState( protoState );
|
proto->SetState( protoState );
|
||||||
|
|
||||||
Float kineticEnergyPAFter = Oyster::Physics3D::Formula::LinearKineticEnergy( protoState.GetMass(), (protoState.GetLinearMomentum() + protoState.GetLinearImpulse())/protoState.GetMass() );
|
Float kineticEnergyPAFter = Oyster::Physics3D::Formula::LinearKineticEnergy( protoState.GetMass(), (protoState.GetLinearMomentum() + protoState.GetLinearImpulse())/protoState.GetMass() );
|
||||||
|
|
||||||
proto->CallSubscription_CollisionResponse( deuter, kineticEnergyPBefore - kineticEnergyPAFter );
|
proto->CallSubscription_AfterCollisionResponse( deuter, kineticEnergyPBefore - kineticEnergyPAFter );
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,12 +363,12 @@ namespace Oyster { namespace Physics
|
||||||
void EventAction_Destruction( ::Utility::DynamicMemory::UniquePointer<::Oyster::Physics::ICustomBody> proto )
|
void EventAction_Destruction( ::Utility::DynamicMemory::UniquePointer<::Oyster::Physics::ICustomBody> proto )
|
||||||
{ /* Do nothing except allowing the proto uniquePointer destroy itself. */ }
|
{ /* Do nothing except allowing the proto uniquePointer destroy itself. */ }
|
||||||
|
|
||||||
::Oyster::Physics::ICustomBody::SubscriptMessage EventAction_Collision( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter )
|
::Oyster::Physics::ICustomBody::SubscriptMessage EventAction_BeforeCollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter )
|
||||||
{ /* Do nothing except returning business as usual. */
|
{ /* Do nothing except returning business as usual. */
|
||||||
return ::Oyster::Physics::ICustomBody::SubscriptMessage_none;
|
return ::Oyster::Physics::ICustomBody::SubscriptMessage_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventAction_CollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss )
|
void EventAction_AfterCollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss )
|
||||||
{ /* Do nothing except returning business as usual. */
|
{ /* Do nothing except returning business as usual. */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,8 @@ namespace Oyster
|
||||||
namespace Default
|
namespace Default
|
||||||
{
|
{
|
||||||
void EventAction_Destruction( ::Utility::DynamicMemory::UniquePointer<::Oyster::Physics::ICustomBody> proto );
|
void EventAction_Destruction( ::Utility::DynamicMemory::UniquePointer<::Oyster::Physics::ICustomBody> proto );
|
||||||
::Oyster::Physics::ICustomBody::SubscriptMessage EventAction_Collision( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter );
|
::Oyster::Physics::ICustomBody::SubscriptMessage EventAction_BeforeCollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter );
|
||||||
void EventAction_CollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
void EventAction_AfterCollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
||||||
void EventAction_Move( const ::Oyster::Physics::ICustomBody *object );
|
void EventAction_Move( const ::Oyster::Physics::ICustomBody *object );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ SimpleRigidBody::SimpleRigidBody()
|
||||||
this->rigid = RigidBody();
|
this->rigid = RigidBody();
|
||||||
this->rigid.SetMass_KeepMomentum( 16.0f );
|
this->rigid.SetMass_KeepMomentum( 16.0f );
|
||||||
this->gravityNormal = Float3::null;
|
this->gravityNormal = Float3::null;
|
||||||
this->onCollision = Default::EventAction_Collision;
|
this->onCollision = Default::EventAction_BeforeCollisionResponse;
|
||||||
this->onCollisionResponse = Default::EventAction_CollisionResponse;
|
this->onCollisionResponse = Default::EventAction_AfterCollisionResponse;
|
||||||
this->onMovement = Default::EventAction_Move;
|
this->onMovement = Default::EventAction_Move;
|
||||||
this->scene = nullptr;
|
this->scene = nullptr;
|
||||||
this->customTag = nullptr;
|
this->customTag = nullptr;
|
||||||
|
@ -72,7 +72,7 @@ SimpleRigidBody::SimpleRigidBody( const API::SimpleBodyDescription &desc )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollision = Default::EventAction_Collision;
|
this->onCollision = Default::EventAction_BeforeCollisionResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( desc.subscription_onCollisionResponse )
|
if( desc.subscription_onCollisionResponse )
|
||||||
|
@ -81,7 +81,7 @@ SimpleRigidBody::SimpleRigidBody( const API::SimpleBodyDescription &desc )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollisionResponse = Default::EventAction_CollisionResponse;
|
this->onCollisionResponse = Default::EventAction_AfterCollisionResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( desc.subscription_onMovement )
|
if( desc.subscription_onMovement )
|
||||||
|
@ -163,12 +163,12 @@ void SimpleRigidBody::SetState( const SimpleRigidBody::State &state )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICustomBody::SubscriptMessage SimpleRigidBody::CallSubscription_Collision( const ICustomBody *deuter )
|
ICustomBody::SubscriptMessage SimpleRigidBody::CallSubscription_BeforeCollisionResponse( const ICustomBody *deuter )
|
||||||
{
|
{
|
||||||
return this->onCollision( this, deuter );
|
return this->onCollision( this, deuter );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRigidBody::CallSubscription_CollisionResponse( const ICustomBody *deuter, Float kineticEnergyLoss )
|
void SimpleRigidBody::CallSubscription_AfterCollisionResponse( const ICustomBody *deuter, Float kineticEnergyLoss )
|
||||||
{
|
{
|
||||||
return this->onCollisionResponse( this, deuter, kineticEnergyLoss );
|
return this->onCollisionResponse( this, deuter, kineticEnergyLoss );
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ void SimpleRigidBody::SetScene( void *scene )
|
||||||
this->scene = (Octree*)scene;
|
this->scene = (Octree*)scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRigidBody::SetSubscription( ICustomBody::EventAction_Collision functionPointer )
|
void SimpleRigidBody::SetSubscription( ICustomBody::EventAction_BeforeCollisionResponse functionPointer )
|
||||||
{
|
{
|
||||||
if( functionPointer )
|
if( functionPointer )
|
||||||
{
|
{
|
||||||
|
@ -326,11 +326,11 @@ void SimpleRigidBody::SetSubscription( ICustomBody::EventAction_Collision functi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollision = Default::EventAction_Collision;
|
this->onCollision = Default::EventAction_BeforeCollisionResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRigidBody::SetSubscription( ICustomBody::EventAction_CollisionResponse functionPointer )
|
void SimpleRigidBody::SetSubscription( ICustomBody::EventAction_AfterCollisionResponse functionPointer )
|
||||||
{
|
{
|
||||||
if( functionPointer )
|
if( functionPointer )
|
||||||
{
|
{
|
||||||
|
@ -338,7 +338,7 @@ void SimpleRigidBody::SetSubscription( ICustomBody::EventAction_CollisionRespons
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollisionResponse = Default::EventAction_CollisionResponse;
|
this->onCollisionResponse = Default::EventAction_AfterCollisionResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ namespace Oyster { namespace Physics
|
||||||
void SetState( const State &state );
|
void SetState( const State &state );
|
||||||
//::Oyster::Math::Float3 GetRigidLinearVelocity() const;
|
//::Oyster::Math::Float3 GetRigidLinearVelocity() const;
|
||||||
|
|
||||||
SubscriptMessage CallSubscription_Collision( const ICustomBody *deuter );
|
SubscriptMessage CallSubscription_BeforeCollisionResponse( const ICustomBody *deuter );
|
||||||
void CallSubscription_CollisionResponse( const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
void CallSubscription_AfterCollisionResponse( const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
||||||
void CallSubscription_Move();
|
void CallSubscription_Move();
|
||||||
|
|
||||||
bool IsAffectedByGravity() const;
|
bool IsAffectedByGravity() const;
|
||||||
|
@ -44,8 +44,8 @@ namespace Oyster { namespace Physics
|
||||||
|
|
||||||
void SetScene( void *scene );
|
void SetScene( void *scene );
|
||||||
|
|
||||||
void SetSubscription( EventAction_Collision functionPointer );
|
void SetSubscription( EventAction_BeforeCollisionResponse functionPointer );
|
||||||
void SetSubscription( EventAction_CollisionResponse functionPointer );
|
void SetSubscription( EventAction_AfterCollisionResponse functionPointer );
|
||||||
void SetSubscription( EventAction_Move functionPointer );
|
void SetSubscription( EventAction_Move functionPointer );
|
||||||
|
|
||||||
void SetGravity( bool ignore);
|
void SetGravity( bool ignore);
|
||||||
|
@ -65,8 +65,8 @@ namespace Oyster { namespace Physics
|
||||||
::Oyster::Physics3D::RigidBody rigid;
|
::Oyster::Physics3D::RigidBody rigid;
|
||||||
::Oyster::Math::Float4 deltaPos, deltaAxis;
|
::Oyster::Math::Float4 deltaPos, deltaAxis;
|
||||||
::Oyster::Math::Float3 gravityNormal;
|
::Oyster::Math::Float3 gravityNormal;
|
||||||
EventAction_Collision onCollision;
|
EventAction_BeforeCollisionResponse onCollision;
|
||||||
EventAction_CollisionResponse onCollisionResponse;
|
EventAction_AfterCollisionResponse onCollisionResponse;
|
||||||
EventAction_Move onMovement;
|
EventAction_Move onMovement;
|
||||||
Octree *scene;
|
Octree *scene;
|
||||||
void *customTag;
|
void *customTag;
|
||||||
|
|
|
@ -13,8 +13,8 @@ SphericalRigidBody::SphericalRigidBody()
|
||||||
this->rigid = RigidBody();
|
this->rigid = RigidBody();
|
||||||
this->rigid.SetMass_KeepMomentum( 10.0f );
|
this->rigid.SetMass_KeepMomentum( 10.0f );
|
||||||
this->gravityNormal = Float3::null;
|
this->gravityNormal = Float3::null;
|
||||||
this->onCollision = Default::EventAction_Collision;
|
this->onCollision = Default::EventAction_BeforeCollisionResponse;
|
||||||
this->onCollisionResponse = Default::EventAction_CollisionResponse;
|
this->onCollisionResponse = Default::EventAction_AfterCollisionResponse;
|
||||||
this->onMovement = Default::EventAction_Move;
|
this->onMovement = Default::EventAction_Move;
|
||||||
this->scene = nullptr;
|
this->scene = nullptr;
|
||||||
this->customTag = nullptr;
|
this->customTag = nullptr;
|
||||||
|
@ -40,7 +40,7 @@ SphericalRigidBody::SphericalRigidBody( const API::SphericalBodyDescription &des
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollision = Default::EventAction_Collision;
|
this->onCollision = Default::EventAction_BeforeCollisionResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( desc.subscription_onCollisionResponse )
|
if( desc.subscription_onCollisionResponse )
|
||||||
|
@ -49,7 +49,7 @@ SphericalRigidBody::SphericalRigidBody( const API::SphericalBodyDescription &des
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollisionResponse = Default::EventAction_CollisionResponse;
|
this->onCollisionResponse = Default::EventAction_AfterCollisionResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( desc.subscription_onMovement )
|
if( desc.subscription_onMovement )
|
||||||
|
@ -128,12 +128,12 @@ void SphericalRigidBody::SetState( const SphericalRigidBody::State &state )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICustomBody::SubscriptMessage SphericalRigidBody::CallSubscription_Collision( const ICustomBody *deuter )
|
ICustomBody::SubscriptMessage SphericalRigidBody::CallSubscription_BeforeCollisionResponse( const ICustomBody *deuter )
|
||||||
{
|
{
|
||||||
return this->onCollision( this, deuter );
|
return this->onCollision( this, deuter );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphericalRigidBody::CallSubscription_CollisionResponse( const ICustomBody *deuter, Float kineticEnergyLoss )
|
void SphericalRigidBody::CallSubscription_AfterCollisionResponse( const ICustomBody *deuter, Float kineticEnergyLoss )
|
||||||
{
|
{
|
||||||
this->onCollisionResponse( this, deuter, kineticEnergyLoss);
|
this->onCollisionResponse( this, deuter, kineticEnergyLoss);
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ void SphericalRigidBody::Predict( ::Oyster::Math::Float4 &outDeltaPos, ::Oyster:
|
||||||
this->rigid.Predict_LeapFrog( outDeltaPos.xyz, outDeltaAxis.xyz, actingLinearImpulse.xyz, actingAngularImpulse.xyz, deltaTime );
|
this->rigid.Predict_LeapFrog( outDeltaPos.xyz, outDeltaAxis.xyz, actingLinearImpulse.xyz, actingAngularImpulse.xyz, deltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphericalRigidBody::SetSubscription( ICustomBody::EventAction_Collision functionPointer )
|
void SphericalRigidBody::SetSubscription( ICustomBody::EventAction_BeforeCollisionResponse functionPointer )
|
||||||
{
|
{
|
||||||
if( functionPointer )
|
if( functionPointer )
|
||||||
{
|
{
|
||||||
|
@ -246,11 +246,11 @@ void SphericalRigidBody::SetSubscription( ICustomBody::EventAction_Collision fun
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollision = Default::EventAction_Collision;
|
this->onCollision = Default::EventAction_BeforeCollisionResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphericalRigidBody::SetSubscription( ICustomBody::EventAction_CollisionResponse functionPointer )
|
void SphericalRigidBody::SetSubscription( ICustomBody::EventAction_AfterCollisionResponse functionPointer )
|
||||||
{
|
{
|
||||||
if( functionPointer )
|
if( functionPointer )
|
||||||
{
|
{
|
||||||
|
@ -258,7 +258,7 @@ void SphericalRigidBody::SetSubscription( ICustomBody::EventAction_CollisionResp
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->onCollisionResponse = Default::EventAction_CollisionResponse;
|
this->onCollisionResponse = Default::EventAction_AfterCollisionResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace Oyster { namespace Physics
|
||||||
void SetState( const State &state );
|
void SetState( const State &state );
|
||||||
//::Oyster::Math::Float3 GetRigidLinearVelocity() const;
|
//::Oyster::Math::Float3 GetRigidLinearVelocity() const;
|
||||||
|
|
||||||
SubscriptMessage CallSubscription_Collision( const ICustomBody *deuter );
|
SubscriptMessage CallSubscription_BeforeCollisionResponse( const ICustomBody *deuter );
|
||||||
void CallSubscription_CollisionResponse( const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
void CallSubscription_AfterCollisionResponse( const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
||||||
void CallSubscription_Move();
|
void CallSubscription_Move();
|
||||||
|
|
||||||
bool IsAffectedByGravity() const;
|
bool IsAffectedByGravity() const;
|
||||||
|
@ -45,8 +45,8 @@ namespace Oyster { namespace Physics
|
||||||
|
|
||||||
void SetScene( void *scene );
|
void SetScene( void *scene );
|
||||||
|
|
||||||
void SetSubscription( EventAction_Collision functionPointer );
|
void SetSubscription( EventAction_BeforeCollisionResponse functionPointer );
|
||||||
void SetSubscription( EventAction_CollisionResponse functionPointer );
|
void SetSubscription( EventAction_AfterCollisionResponse functionPointer );
|
||||||
void SetSubscription( EventAction_Move functionPointer );
|
void SetSubscription( EventAction_Move functionPointer );
|
||||||
|
|
||||||
void SetGravity( bool ignore);
|
void SetGravity( bool ignore);
|
||||||
|
@ -66,8 +66,8 @@ namespace Oyster { namespace Physics
|
||||||
::Oyster::Physics3D::RigidBody rigid;
|
::Oyster::Physics3D::RigidBody rigid;
|
||||||
::Oyster::Math::Float4 deltaPos, deltaAxis;
|
::Oyster::Math::Float4 deltaPos, deltaAxis;
|
||||||
::Oyster::Math::Float3 gravityNormal;
|
::Oyster::Math::Float3 gravityNormal;
|
||||||
EventAction_Collision onCollision;
|
EventAction_BeforeCollisionResponse onCollision;
|
||||||
EventAction_CollisionResponse onCollisionResponse;
|
EventAction_AfterCollisionResponse onCollisionResponse;
|
||||||
EventAction_Move onMovement;
|
EventAction_Move onMovement;
|
||||||
Octree *scene;
|
Octree *scene;
|
||||||
void *customTag;
|
void *customTag;
|
||||||
|
|
|
@ -244,8 +244,8 @@ namespace Oyster
|
||||||
SubscriptMessage_ignore_collision_response
|
SubscriptMessage_ignore_collision_response
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
|
typedef SubscriptMessage (*EventAction_BeforeCollisionResponse)( const ICustomBody *proto, const ICustomBody *deuter );
|
||||||
typedef void (*EventAction_CollisionResponse)( const ICustomBody *proto, const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
typedef void (*EventAction_AfterCollisionResponse)( const ICustomBody *proto, const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
|
||||||
typedef void (*EventAction_Move)( const ICustomBody *object );
|
typedef void (*EventAction_Move)( const ICustomBody *object );
|
||||||
typedef Struct::SimpleBodyDescription SimpleBodyDescription;
|
typedef Struct::SimpleBodyDescription SimpleBodyDescription;
|
||||||
typedef Struct::SphericalBodyDescription SphericalBodyDescription;
|
typedef Struct::SphericalBodyDescription SphericalBodyDescription;
|
||||||
|
@ -262,12 +262,12 @@ namespace Oyster
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* @todo TODO: need doc
|
* @todo TODO: need doc
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual SubscriptMessage CallSubscription_Collision( const ICustomBody *deuter ) = 0;
|
virtual SubscriptMessage CallSubscription_BeforeCollisionResponse( const ICustomBody *deuter ) = 0;
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* @todo TODO: need doc
|
* @todo TODO: need doc
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual void CallSubscription_CollisionResponse( const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss ) = 0;
|
virtual void CallSubscription_AfterCollisionResponse( const ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss ) = 0;
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* @todo TODO: need doc
|
* @todo TODO: need doc
|
||||||
|
@ -397,14 +397,14 @@ namespace Oyster
|
||||||
* whenever a collision occurs.
|
* whenever a collision occurs.
|
||||||
* @param functionPointer: If NULL, an empty default function will be set.
|
* @param functionPointer: If NULL, an empty default function will be set.
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual void SetSubscription( EventAction_Collision functionPointer ) = 0;
|
virtual void SetSubscription( EventAction_BeforeCollisionResponse functionPointer ) = 0;
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Sets the function that will be called by the engine
|
* Sets the function that will be called by the engine
|
||||||
* whenever a collision has finished.
|
* whenever a collision has finished.
|
||||||
* @param functionPointer: If NULL, an empty default function will be set.
|
* @param functionPointer: If NULL, an empty default function will be set.
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual void SetSubscription( EventAction_CollisionResponse functionPointer ) = 0;
|
virtual void SetSubscription( EventAction_AfterCollisionResponse functionPointer ) = 0;
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Sets the function that will be called by the engine
|
* Sets the function that will be called by the engine
|
||||||
|
|
|
@ -19,8 +19,8 @@ namespace Oyster { namespace Physics
|
||||||
::Oyster::Math::Float frictionCoeff_Static;
|
::Oyster::Math::Float frictionCoeff_Static;
|
||||||
::Oyster::Math::Float frictionCoeff_Dynamic;
|
::Oyster::Math::Float frictionCoeff_Dynamic;
|
||||||
::Oyster::Physics3D::MomentOfInertia inertiaTensor;
|
::Oyster::Physics3D::MomentOfInertia inertiaTensor;
|
||||||
::Oyster::Physics::ICustomBody::EventAction_Collision subscription_onCollision;
|
::Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse subscription_onCollision;
|
||||||
::Oyster::Physics::ICustomBody::EventAction_CollisionResponse subscription_onCollisionResponse;
|
::Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse subscription_onCollisionResponse;
|
||||||
::Oyster::Physics::ICustomBody::EventAction_Move subscription_onMovement;
|
::Oyster::Physics::ICustomBody::EventAction_Move subscription_onMovement;
|
||||||
bool ignoreGravity;
|
bool ignoreGravity;
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ namespace Oyster { namespace Physics
|
||||||
::Oyster::Math::Float restitutionCoeff;
|
::Oyster::Math::Float restitutionCoeff;
|
||||||
::Oyster::Math::Float frictionCoeff_Static;
|
::Oyster::Math::Float frictionCoeff_Static;
|
||||||
::Oyster::Math::Float frictionCoeff_Dynamic;
|
::Oyster::Math::Float frictionCoeff_Dynamic;
|
||||||
::Oyster::Physics::ICustomBody::EventAction_Collision subscription_onCollision;
|
::Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse subscription_onCollision;
|
||||||
::Oyster::Physics::ICustomBody::EventAction_CollisionResponse subscription_onCollisionResponse;
|
::Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse subscription_onCollisionResponse;
|
||||||
::Oyster::Physics::ICustomBody::EventAction_Move subscription_onMovement;
|
::Oyster::Physics::ICustomBody::EventAction_Move subscription_onMovement;
|
||||||
bool ignoreGravity;
|
bool ignoreGravity;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue