mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-24 01:59:15 +01:00
new curves + boat fix
This commit is contained in:
parent
5fd8eec42c
commit
3de003a8e7
@ -11,7 +11,7 @@ float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float di
|
|||||||
if (dp > 0.9f)
|
if (dp > 0.9f)
|
||||||
return distance + Abs((pPoint1->x * dir1Y - pPoint1->y * dir1X) - (pPoint2->x * dir1Y - pPoint2->y * dir1X));
|
return distance + Abs((pPoint1->x * dir1Y - pPoint1->y * dir1X) - (pPoint2->x * dir1Y - pPoint2->y * dir1X));
|
||||||
else
|
else
|
||||||
return ((1.0f - dp) * 0.2f + 1.0f) * distance;
|
return ((1.0f - dp) * 0.25f + 1.0f) * distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVector* pDir2, float between, int32 timeOnCurve, CVector* pOutPos, CVector* pOutDir)
|
void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVector* pDir2, float between, int32 timeOnCurve, CVector* pOutPos, CVector* pOutDir)
|
||||||
@ -19,7 +19,21 @@ void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVe
|
|||||||
float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y);
|
float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y);
|
||||||
CVector2D dir1 = *pDir1 * actualFactor;
|
CVector2D dir1 = *pDir1 * actualFactor;
|
||||||
CVector2D dir2 = *pDir2 * actualFactor;
|
CVector2D dir2 = *pDir2 * actualFactor;
|
||||||
float curveCoef = 0.5f - 0.5f * Cos(3.1415f * between);
|
float t1 = Abs(DotProduct2D(*pPos1 - *pPos2, *pDir1));
|
||||||
|
float t2 = Abs(DotProduct2D(*pPos2 - *pPos1, *pDir2));
|
||||||
|
float curveCoef;
|
||||||
|
if (t1 > t2) {
|
||||||
|
if (between < (t1 - t2) / (t1 + t2))
|
||||||
|
curveCoef = 0.0f;
|
||||||
|
else
|
||||||
|
curveCoef = 0.5f - 0.5f * Cos(3.1415f * (t1 + t2) / (2 * t2) * (between - (t1 - t2) / (t1 + t2)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (2 * t1 / (t1 + t2) < between)
|
||||||
|
curveCoef = 1.0f;
|
||||||
|
else
|
||||||
|
curveCoef = 0.5f - 0.5f * Cos(3.1415f * between * (t1 + t2) / (2 * t1));
|
||||||
|
}
|
||||||
*pOutPos = CVector(
|
*pOutPos = CVector(
|
||||||
(pPos1->x + between * dir1.x) * (1.0f - curveCoef) + (pPos2->x - (1 - between) * dir2.x) * curveCoef,
|
(pPos1->x + between * dir1.x) * (1.0f - curveCoef) + (pPos2->x - (1 - between) * dir2.x) * curveCoef,
|
||||||
(pPos1->y + between * dir1.y) * (1.0f - curveCoef) + (pPos2->y - (1 - between) * dir2.y) * curveCoef,
|
(pPos1->y + between * dir1.y) * (1.0f - curveCoef) + (pPos2->y - (1 - between) * dir2.y) * curveCoef,
|
||||||
|
@ -431,7 +431,7 @@ CBoat::ProcessControl(void)
|
|||||||
speedUp = pHandling->fBrakeDeceleration - m_vecMoveSpeed.z;
|
speedUp = pHandling->fBrakeDeceleration - m_vecMoveSpeed.z;
|
||||||
if(speedUp < 0.0f) speedUp = 0.0f;
|
if(speedUp < 0.0f) speedUp = 0.0f;
|
||||||
float speedFwd = DotProduct(m_vecMoveSpeed, GetForward());
|
float speedFwd = DotProduct(m_vecMoveSpeed, GetForward());
|
||||||
speedFwd *= -m_nDeltaVolumeUnderWater * 0.01f * pHandling->fTractionLoss;
|
speedFwd *= -m_nDeltaVolumeUnderWater * 0.01f * pHandling->fBrakeBias;
|
||||||
CVector speed = speedFwd*GetForward() + CVector(0.0f, 0.0f, speedUp);
|
CVector speed = speedFwd*GetForward() + CVector(0.0f, 0.0f, speedUp);
|
||||||
CVector splashImpulse = speed * m_fMass;
|
CVector splashImpulse = speed * m_fMass;
|
||||||
ApplyMoveForce(splashImpulse);
|
ApplyMoveForce(splashImpulse);
|
||||||
|
Loading…
Reference in New Issue
Block a user