mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-24 05:45:40 +00:00
aiInfo getPosition now optionally takes a doCastray bool (off by default)
AIFlyingVehicleControllerData add flightfloor and cieling resolvepitch from (portions of) the old aiflyingvehicle resource no reversing for flyingvehicles, so bottom out resolvespeed at 0
This commit is contained in:
parent
6200a6f1fb
commit
584093f48d
5 changed files with 96 additions and 21 deletions
|
|
@ -52,10 +52,30 @@ AIInfo::AIInfo(AIController* controller, Point3F pointIn, F32 radIn)
|
|||
mPosSet = true;
|
||||
};
|
||||
|
||||
Point3F AIInfo::getPosition(bool doCastray)
|
||||
{
|
||||
Point3F pos = (mObj.isValid()) ? mObj->getPosition() : mPosition;
|
||||
if (doCastray)
|
||||
{
|
||||
RayInfo info;
|
||||
if (gServerContainer.castRay(pos, pos - Point3F(0, 0, getCtrl()->mControllerData->mHeightTolerance), StaticShapeObjectType, &info))
|
||||
{
|
||||
pos = info.point;
|
||||
}
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
F32 AIInfo::getDist()
|
||||
{
|
||||
AIInfo* controlObj = getCtrl()->getAIInfo();
|
||||
F32 ret = VectorF(controlObj->getPosition() - getPosition()).len();
|
||||
Point3F targPos = getPosition();
|
||||
|
||||
if (mFabs(targPos.z - controlObj->getPosition().z) < getCtrl()->mControllerData->mHeightTolerance)
|
||||
targPos.z = controlObj->getPosition().z;
|
||||
|
||||
F32 ret = VectorF(controlObj->getPosition() - targPos).len();
|
||||
ret -= controlObj->mRadius + mRadius;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue