From 04a2642f85f2b1bd080aea7e114a8a712d060dcb Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 30 May 2014 01:00:22 +0200 Subject: [PATCH] Tank shell inheriting velocity --- src/Systems/TankSteeringSystem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Systems/TankSteeringSystem.cpp b/src/Systems/TankSteeringSystem.cpp index 1d028d9..cc1008b 100644 --- a/src/Systems/TankSteeringSystem.cpp +++ b/src/Systems/TankSteeringSystem.cpp @@ -62,6 +62,7 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit if(barrelSteeringComponent) { + auto tankTransform = m_World->GetComponent(entity); auto transformComponent = m_World->GetComponent(tankSteeringComponent->Barrel); auto absoluteTransform = m_World->GetSystem()->AbsoluteTransform(tankSteeringComponent->Barrel); glm::quat orientation = glm::angleAxis(barrelSteeringComponent->TurnSpeed * inputController->BarrelDirection * (float)dt, barrelSteeringComponent->Axis); @@ -76,7 +77,7 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit cloneTransform->Orientation = absoluteTransform.Orientation * cloneTransform->Orientation; Events::SetVelocity eSetVelocity; eSetVelocity.Entity = clone; - eSetVelocity.Velocity = absoluteTransform.Orientation * (glm::vec3(0.f, 0.f, -1.f) * barrelSteeringComponent->ShotSpeed); + eSetVelocity.Velocity = tankTransform->Velocity + absoluteTransform.Orientation * (glm::vec3(0.f, 0.f, -1.f) * barrelSteeringComponent->ShotSpeed); EventBroker->Publish(eSetVelocity); m_TimeSinceLastShot[tankSteeringComponent->Barrel] = 0;