mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-23 05:53:34 +00:00
cleanup
This commit is contained in:
parent
a5ff93351d
commit
dffcbcd4d4
@ -15,17 +15,13 @@ void ChangeOrientationBehavior::Calculate(BehaviorContext* context, RakNet::BitS
|
|||||||
else destinationEntity = EntityManager::Instance()->GetEntity(context->originator);
|
else destinationEntity = EntityManager::Instance()->GetEntity(context->originator);
|
||||||
if (!destinationEntity) return;
|
if (!destinationEntity) return;
|
||||||
|
|
||||||
const auto source = sourceEntity->GetPosition();
|
sourceEntity->SetRotation(
|
||||||
const auto destination = destinationEntity->GetPosition();
|
NiQuaternion::LookAt(sourceEntity->GetPosition(), destinationEntity->GetPosition())
|
||||||
sourceEntity->SetRotation(NiQuaternion::LookAt(source, destination));
|
);
|
||||||
} else if (this->m_toAngle){
|
} else if (this->m_toAngle){
|
||||||
auto baseAngle = NiPoint3(this->m_angle, 0, 0);
|
auto baseAngle = NiPoint3(this->m_angle, 0, 0);
|
||||||
if (this->m_relative){
|
if (this->m_relative) baseAngle += sourceEntity->GetRotation().GetEulerAngles();
|
||||||
auto sourceAngle = sourceEntity->GetRotation().GetEulerAngles();
|
sourceEntity->SetRotation(NiQuaternion::FromEulerAngles(baseAngle));
|
||||||
baseAngle += sourceAngle;
|
|
||||||
}
|
|
||||||
auto newRotation = NiQuaternion::FromEulerAngles(baseAngle);
|
|
||||||
sourceEntity->SetRotation(newRotation);
|
|
||||||
} else return;
|
} else return;
|
||||||
EntityManager::Instance()->SerializeEntity(sourceEntity);
|
EntityManager::Instance()->SerializeEntity(sourceEntity);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user