public static SteeringOutput GetSteering(KinematicState ownKS, SArrive info) { Vector3 l_distanceToTarget = info.m_target.position - ownKS.m_position; if (l_distanceToTarget.magnitude < info.m_closeEnoughRadius) { return(NULL_STEERING); } if (l_distanceToTarget.magnitude > info.m_slowDownRadius) { return(Seek.GetSteering(ownKS, info.m_target)); } float l_desiredSpeed = ownKS.m_maxLinearSpeed * (l_distanceToTarget.magnitude / info.m_slowDownRadius); Vector3 l_desiredVelocity = l_distanceToTarget.normalized * l_desiredSpeed; Vector3 l_requiredAcceleration = (l_desiredVelocity - ownKS.m_linearVelocity) / info.m_timeToDesiredSpeed; l_requiredAcceleration = MathExtent.Clip(l_requiredAcceleration, ownKS.m_maxLinearAcceleration); SteeringOutput result = new SteeringOutput(); result.m_linearAcceleration = l_requiredAcceleration; return(result); }
public static SteeringOutput GetSteering(KinematicState me, SKeepPosition info, SArrive arriveInfo) { float targetOrientation = info.m_target.transform.eulerAngles.y; targetOrientation += info.m_requiredAngle; Vector3 finalTargetPosition = MathExtent.AngleToVector(targetOrientation).normalized; finalTargetPosition *= info.m_requiredDistance; SURROGATE_TARGET.position = info.m_target.position + finalTargetPosition; arriveInfo.m_target = SURROGATE_TARGET; return(Arrive.GetSteering(me, arriveInfo)); }
public void SetInfo(SKeepPosition info, SArrive arriveInfo) { m_keepPositioninfo = info; m_arriveInfo = arriveInfo; }
public void SetInfo(SArrive info) { m_info = info; }