Tank shell inheriting velocity
This commit is contained in:
@@ -62,6 +62,7 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit
|
||||
|
||||
if(barrelSteeringComponent)
|
||||
{
|
||||
auto tankTransform = m_World->GetComponent<Components::Transform>(entity);
|
||||
auto transformComponent = m_World->GetComponent<Components::Transform>(tankSteeringComponent->Barrel);
|
||||
auto absoluteTransform = m_World->GetSystem<Systems::TransformSystem>()->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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user