mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
more cleanups and standardizations
This commit is contained in:
parent
d8ea8803c3
commit
c1d32a9fd6
1 changed files with 13 additions and 17 deletions
|
|
@ -669,16 +669,17 @@ void AIWheeledVehicleControllerData::resolveYaw(AIController* obj, Point3F locat
|
|||
right.normalize();
|
||||
Point3F aimLoc = obj->mMovement.mAimLocation;
|
||||
|
||||
// Get the Target to AI vector and normalize it.
|
||||
Point3F toTarg = aimLoc - location;
|
||||
// Get the AI to Target vector and normalize it.
|
||||
Point3F toTarg = location - aimLoc;
|
||||
toTarg.normalize();
|
||||
|
||||
F32 dotYaw = mDot(right, toTarg);
|
||||
F32 dotYaw = -mDot(right, toTarg);
|
||||
movePtr->yaw = -lastYaw;
|
||||
|
||||
VehicleData* vd = (VehicleData*)(wvo->getDataBlock());
|
||||
F32 maxSteeringAngle = vd->maxSteeringAngle;
|
||||
if (mFabs(dotYaw) > maxSteeringAngle * 1.5 && wvo->getThrottle() < 0.0f)
|
||||
|
||||
if (mFabs(dotYaw) > maxSteeringAngle*1.5f)
|
||||
dotYaw *= -1.0f;
|
||||
|
||||
if (dotYaw > maxSteeringAngle) dotYaw = maxSteeringAngle;
|
||||
|
|
@ -745,10 +746,10 @@ void AIFlyingVehicleControllerData::resolveYaw(AIController* obj, Point3F locati
|
|||
Point3F aimLoc = obj->mMovement.mAimLocation;
|
||||
|
||||
// Get the Target to AI vector and normalize it.
|
||||
Point3F toTarg = aimLoc - location;
|
||||
Point3F toTarg = location - aimLoc;
|
||||
toTarg.normalize();
|
||||
|
||||
F32 dotYaw = mDot(right, toTarg);
|
||||
F32 dotYaw = -mDot(right, toTarg);
|
||||
movePtr->yaw = 0;
|
||||
|
||||
if (mFabs(dotYaw) > 0.05f)
|
||||
|
|
@ -772,19 +773,14 @@ void AIFlyingVehicleControllerData::resolvePitch(AIController* obj, Point3F loca
|
|||
Point3F aimLoc = obj->mMovement.mAimLocation;
|
||||
aimLoc.z = mClampF(aimLoc.z, mFlightFloor, mFlightCeiling);
|
||||
|
||||
// Get the AI to Target vector and normalize it.
|
||||
Point3F toTarg = location-aimLoc;
|
||||
// Get the Target to AI vector and normalize it.
|
||||
Point3F toTarg = location - aimLoc;
|
||||
toTarg.normalize();
|
||||
|
||||
F32 lastPitch = fvo->getSteering().y;
|
||||
movePtr->pitch = 0.0f;
|
||||
Point3F forward = fvo->getTransform().getForwardVector();
|
||||
if (mDot(forward, toTarg)>0.0f)
|
||||
{
|
||||
F32 dotPitch = mDot(up, toTarg);
|
||||
|
||||
if (mFabs(dotPitch) > 0.05f)
|
||||
movePtr->pitch = dotPitch;
|
||||
}
|
||||
F32 dotPitch = -mDot(up, toTarg);
|
||||
if (mFabs(dotPitch) > 0.05f)
|
||||
movePtr->pitch = dotPitch - lastPitch;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue