mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
skip sidestepping off a cliff raycast if we're not sidestepping
take current velocity into account for vehicles since some degree of momentum will be maintained
This commit is contained in:
parent
675bdfe6b3
commit
b2021caa6d
2 changed files with 24 additions and 22 deletions
|
|
@ -670,7 +670,7 @@ void AIWheeledVehicleControllerData::resolveYaw(AIController* obj, Point3F locat
|
||||||
Point3F aimLoc = obj->mMovement.mAimLocation;
|
Point3F aimLoc = obj->mMovement.mAimLocation;
|
||||||
|
|
||||||
// Get the AI to Target vector and normalize it.
|
// Get the AI to Target vector and normalize it.
|
||||||
Point3F toTarg = location - aimLoc;
|
Point3F toTarg = (location + wvo->getVelocity() * TickSec) - aimLoc;
|
||||||
toTarg.normalize();
|
toTarg.normalize();
|
||||||
|
|
||||||
F32 dotYaw = -mDot(right, toTarg);
|
F32 dotYaw = -mDot(right, toTarg);
|
||||||
|
|
@ -746,7 +746,7 @@ void AIFlyingVehicleControllerData::resolveYaw(AIController* obj, Point3F locati
|
||||||
Point3F aimLoc = obj->mMovement.mAimLocation;
|
Point3F aimLoc = obj->mMovement.mAimLocation;
|
||||||
|
|
||||||
// Get the Target to AI vector and normalize it.
|
// Get the Target to AI vector and normalize it.
|
||||||
Point3F toTarg = location - aimLoc;
|
Point3F toTarg = (location + fvo->getVelocity() * TickSec) - aimLoc;
|
||||||
toTarg.normalize();
|
toTarg.normalize();
|
||||||
|
|
||||||
F32 dotYaw = -mDot(right, toTarg);
|
F32 dotYaw = -mDot(right, toTarg);
|
||||||
|
|
@ -774,7 +774,7 @@ void AIFlyingVehicleControllerData::resolvePitch(AIController* obj, Point3F loca
|
||||||
aimLoc.z = mClampF(aimLoc.z, mFlightFloor, mFlightCeiling);
|
aimLoc.z = mClampF(aimLoc.z, mFlightFloor, mFlightCeiling);
|
||||||
|
|
||||||
// Get the Target to AI vector and normalize it.
|
// Get the Target to AI vector and normalize it.
|
||||||
Point3F toTarg = location - aimLoc;
|
Point3F toTarg = (location + fvo->getVelocity() * TickSec) - aimLoc;
|
||||||
toTarg.normalize();
|
toTarg.normalize();
|
||||||
F32 lastPitch = fvo->getSteering().y;
|
F32 lastPitch = fvo->getSteering().y;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,7 @@ bool AINavigation::flock()
|
||||||
|
|
||||||
F32 maxFlocksq = flockingData.mMax * flockingData.mMax;
|
F32 maxFlocksq = flockingData.mMax * flockingData.mMax;
|
||||||
bool flocking = false;
|
bool flocking = false;
|
||||||
|
U32 found = 0;
|
||||||
if (getCtrl()->getGoal())
|
if (getCtrl()->getGoal())
|
||||||
{
|
{
|
||||||
Point3F dest = mMoveDestination;
|
Point3F dest = mMoveDestination;
|
||||||
|
|
@ -327,7 +328,6 @@ bool AINavigation::flock()
|
||||||
sql.mList.remove(obj);
|
sql.mList.remove(obj);
|
||||||
|
|
||||||
Point3F avoidanceOffset = Point3F::Zero;
|
Point3F avoidanceOffset = Point3F::Zero;
|
||||||
U32 found = 0;
|
|
||||||
|
|
||||||
//avoid objects in the way
|
//avoid objects in the way
|
||||||
RayInfo info;
|
RayInfo info;
|
||||||
|
|
@ -390,7 +390,8 @@ bool AINavigation::flock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (found > 0)
|
||||||
|
{
|
||||||
avoidanceOffset.z = 0;
|
avoidanceOffset.z = 0;
|
||||||
avoidanceOffset.x = (mRandF() * avoidanceOffset.x) * 0.5 + avoidanceOffset.x * 0.75;
|
avoidanceOffset.x = (mRandF() * avoidanceOffset.x) * 0.5 + avoidanceOffset.x * 0.75;
|
||||||
avoidanceOffset.y = (mRandF() * avoidanceOffset.y) * 0.5 + avoidanceOffset.y * 0.75;
|
avoidanceOffset.y = (mRandF() * avoidanceOffset.y) * 0.5 + avoidanceOffset.y * 0.75;
|
||||||
|
|
@ -416,6 +417,7 @@ bool AINavigation::flock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
obj->enableCollision();
|
obj->enableCollision();
|
||||||
return flocking;
|
return flocking;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue