diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-05 13:40:56 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-05 13:40:56 +0200 |
commit | ee261c996b6864ad65f086d97cdb47469c10a651 (patch) | |
tree | f594437503cd2ef4116e9b8c8b6560b970c77541 /src/vehicles | |
parent | CAutoPilot + CCarAI + fixes (diff) | |
parent | SetPosition, final part (diff) | |
download | re3-ee261c996b6864ad65f086d97cdb47469c10a651.tar re3-ee261c996b6864ad65f086d97cdb47469c10a651.tar.gz re3-ee261c996b6864ad65f086d97cdb47469c10a651.tar.bz2 re3-ee261c996b6864ad65f086d97cdb47469c10a651.tar.lz re3-ee261c996b6864ad65f086d97cdb47469c10a651.tar.xz re3-ee261c996b6864ad65f086d97cdb47469c10a651.tar.zst re3-ee261c996b6864ad65f086d97cdb47469c10a651.zip |
Diffstat (limited to 'src/vehicles')
-rw-r--r-- | src/vehicles/Automobile.cpp | 10 | ||||
-rw-r--r-- | src/vehicles/Plane.cpp | 20 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 58971786..9db60da0 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -3186,10 +3186,10 @@ CAutomobile::PlaceOnRoadProperly(void) float c = Cos(angle); float s = Sin(angle); - GetRight() = CVector((front.y - rear.y)/len, -(front.x - rear.x)/len, 0.0f); - GetForward() = CVector(-c*GetRight().y, c*GetRight().x, s); - GetUp() = CrossProduct(GetRight(), GetForward()); - GetPosition() = CVector((front.x + rear.x)/2.0f, (front.y + rear.y)/2.0f, (frontZ + rearZ)/2.0f + GetHeightAboveRoad()); + GetMatrix().GetRight() = CVector((front.y - rear.y) / len, -(front.x - rear.x) / len, 0.0f); + GetMatrix().GetForward() = CVector(-c * GetRight().y, c * GetRight().x, s); + GetMatrix().GetUp() = CrossProduct(GetRight(), GetForward()); + GetMatrix().GetPosition() = CVector((front.x + rear.x) / 2.0f, (front.y + rear.y) / 2.0f, (frontZ + rearZ) / 2.0f + GetHeightAboveRoad()); } void @@ -4408,7 +4408,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) if(GetUp().z > 0.0f){ // simulate fast upward movement if going fast float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr(); - obj->GetPosition() += GetUp()*speed; + obj->GetMatrix().Translate(GetUp()*speed); } } obj->ApplyMoveForce(dist); diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index 10ce225a..71189d84 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -359,8 +359,8 @@ CPlane::ProcessControl(void) CVector posFront2 = (1.0f - f)*pPathNodes[curPathNodeFront2].p + f*pPathNodes[nextPathNodeFront2].p; // Now set matrix - GetPosition() = (posRear + posFront)/2.0f; - GetPosition().z += 4.3f; + GetMatrix().GetPosition() = (posRear + posFront) / 2.0f; + GetMatrix().GetPosition().z += 4.3f; CVector fwd = posFront - posRear; fwd.Normalise(); if(pitch != 0.0f){ @@ -375,9 +375,9 @@ CPlane::ProcessControl(void) right.z += 3.0f*roll.z; right.Normalise(); CVector up = CrossProduct(right, fwd); - GetRight() = right; - GetUp() = up; - GetForward() = fwd; + GetMatrix().GetRight() = right; + GetMatrix().GetUp() = up; + GetMatrix().GetForward() = fwd; // Set speed m_vecMoveSpeed = fwd*PlanePathSpeed[m_nPlaneId]/60.0f; @@ -511,8 +511,8 @@ CPlane::ProcessControl(void) CVector posFront2 = (1.0f - f)*pathNodes[curPathNodeFront2].p + f*pathNodes[nextPathNodeFront2].p; // Now set matrix - GetPosition() = (posRear + posFront)/2.0f; - GetPosition().z += 1.0f; + GetMatrix().GetPosition() = (posRear + posFront) / 2.0f; + GetMatrix().GetPosition().z += 1.0f; CVector fwd = posFront - posRear; fwd.Normalise(); CVector fwd2 = posFront2 - posRear; @@ -522,9 +522,9 @@ CPlane::ProcessControl(void) right.z += 3.0f*roll.z; right.Normalise(); CVector up = CrossProduct(right, fwd); - GetRight() = right; - GetUp() = up; - GetForward() = fwd; + GetMatrix().GetRight() = right; + GetMatrix().GetUp() = up; + GetMatrix().GetForward() = fwd; // Set speed m_vecMoveSpeed = fwd*planePathSpeed/60.0f; |