From c740bd593566070d744d1eb562ede6e1c88bd5b9 Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Thu, 12 Dec 2013 10:02:35 +0100 Subject: [PATCH] Added some data to PhysicsAPI GetRigidLinearVelocity() and void* as reference to game object. --- Bin/Content/Shaders/TextureDebug.cso | Bin 14560 -> 14560 bytes .../Implementation/SimpleRigidBody.cpp | 6 ++++++ .../Implementation/SimpleRigidBody.h | 1 + .../Implementation/SphericalRigidBody.cpp | 5 +++++ .../Implementation/SphericalRigidBody.h | 1 + Code/GamePhysics/PhysicsAPI.h | 10 ++++++++++ 6 files changed, 23 insertions(+) diff --git a/Bin/Content/Shaders/TextureDebug.cso b/Bin/Content/Shaders/TextureDebug.cso index 0dc6bcffa9d17cf2aa80d41dbe8b05fa689ed0ac..23c9aa238f2caca3ef27eaef75cc83f52464c37c 100644 GIT binary patch delta 623 zcmaD*_@Ge4CBn&h70aI$-5H{x-{K2bK8^fgxKZQ+kA#2a${;*$!r)yt7q|OPHaFxp|CxW{E;jYC(Q+W=Vcg<>Xo7rjvEV#YM`%lIcLnB7~%; zxVH!nT`stEm`;|I=ogTFWWcxvXs_n8s5{6Ojs6XSu+du84E8Ba`R z)%9m~=t!L$uA3_p4^%|Jzd{mt6gW&y)=QlHfQLmASLD2({8!HeR{*$AuG8noB?$^0 zZcA363%P(86j^pa3<82c%nrmoK+FlmAOKRQ1jHOb3{uZFS&(EqQO9|2|#=v Qh%JCJAaG*yUxUZ&0A8h{KmY&$ delta 494 zcmaD*_@Ge4CBn&>|Fq1T6$_ab$!`j??QVUnv{B>&kHmxQIYEpJ3=Hz;J|3t}>GPdk z_Pus_LGp~ve|VlSZkFIrVAKo-N(TY)5+HsD#1BF0(SQX|jB)Zp0sF}dm@GCw5a3|r z4`2qWakh$aNz8M~Oe~)KK-Zm{A=xS>B{44v#9yy(I(e437#m#Lbn;Jeejpbr>o7S+ zqGfW5u~EaaNE_@McBkWX8=8r0y^=F4??S)}5bm&16bNK>+icp;I zjp|hH$@O}PK<~;-e!#;bi7Om0PyVZCg7B2-rigid.GetView(); } +Float3 SimpleRigidBody::GetRigidLinearVelocity() const +{ + return this->rigid.GetLinearVelocity(); +} + + UpdateState SimpleRigidBody::Update( Float timeStepLength ) { this->rigid.Update_LeapFrog( timeStepLength ); diff --git a/Code/GamePhysics/Implementation/SimpleRigidBody.h b/Code/GamePhysics/Implementation/SimpleRigidBody.h index 774420c5..9eefeb48 100644 --- a/Code/GamePhysics/Implementation/SimpleRigidBody.h +++ b/Code/GamePhysics/Implementation/SimpleRigidBody.h @@ -18,6 +18,7 @@ namespace Oyster { namespace Physics State GetState() const; State & GetState( State &targetMem ) const; void SetState( const State &state ); + ::Oyster::Math::Float3 GetRigidLinearVelocity() const; void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter ); bool IsAffectedByGravity() const; diff --git a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp index 34160192..364d7454 100644 --- a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp +++ b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp @@ -126,6 +126,11 @@ Float4x4 & SphericalRigidBody::GetView( Float4x4 &targetMem ) const return targetMem = this->rigid.GetView(); } +Float3 SphericalRigidBody::GetRigidLinearVelocity() const +{ + return this->rigid.GetLinearVelocity(); +} + UpdateState SphericalRigidBody::Update( Float timeStepLength ) { this->rigid.Update_LeapFrog( timeStepLength ); diff --git a/Code/GamePhysics/Implementation/SphericalRigidBody.h b/Code/GamePhysics/Implementation/SphericalRigidBody.h index 1aca514d..4d003f99 100644 --- a/Code/GamePhysics/Implementation/SphericalRigidBody.h +++ b/Code/GamePhysics/Implementation/SphericalRigidBody.h @@ -19,6 +19,7 @@ namespace Oyster { namespace Physics State GetState() const; State & GetState( State &targetMem = State() ) const; void SetState( const State &state ); + ::Oyster::Math::Float3 GetRigidLinearVelocity() const; void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter ); bool IsAffectedByGravity() const; diff --git a/Code/GamePhysics/PhysicsAPI.h b/Code/GamePhysics/PhysicsAPI.h index 387bf0e6..84a3d639 100644 --- a/Code/GamePhysics/PhysicsAPI.h +++ b/Code/GamePhysics/PhysicsAPI.h @@ -243,6 +243,11 @@ namespace Oyster SubscriptMessage_ignore_collision_response }; + /******************************************************** + * @param gameObjectRef: a pointer to the object in the game owning the rigid body. + ********************************************************/ + void* gameObjectRef; + typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter ); typedef Struct::SimpleBodyDescription SimpleBodyDescription; typedef Struct::SphericalBodyDescription SphericalBodyDescription; @@ -271,6 +276,11 @@ namespace Oyster ********************************************************/ virtual State & GetState( State &targetMem ) const = 0; + /******************************************************** + * @return the linear velocity of the rigid body in a vector. + ********************************************************/ + virtual Math::Float3 GetRigidLinearVelocity() const = 0; + /******************************************************** * @todo TODO: need doc ********************************************************/