From b3656a052742f100da432e772b7130e50a6f0fba Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Fri, 31 Jan 2014 15:15:08 +0100 Subject: [PATCH] Gravity fix --- Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp | 2 +- Code/GamePhysics/Implementation/SphericalRigidBody.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp b/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp index 30ced129..12c46cd5 100644 --- a/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp +++ b/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp @@ -187,7 +187,7 @@ void API_Impl::Update() if( gravityImpulse != Float4::null ) { state.ApplyLinearImpulse( gravityImpulse.xyz ); - (*proto)->SetGravityNormal( gravityImpulse.GetNormalized().xyz ); + state.SetGravityNormal( gravityImpulse.GetNormalized().xyz ); (*proto)->SetState( state ); } diff --git a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp index 539093db..633997ef 100644 --- a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp +++ b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp @@ -105,6 +105,7 @@ void SphericalRigidBody::SetState( const SphericalRigidBody::State &state ) this->rigid.frictionCoeff_Kinetic = state.GetFrictionCoeff_Kinetic(); this->rigid.SetMass_KeepMomentum( state.GetMass() ); this->rigid.SetMomentOfInertia_KeepMomentum( state.GetMomentOfInertia() ); + this->rigid.gravityNormal = state.GetGravityNormal(); if( state.IsForwarded() ) {