public static SteeringOutput GetSteering(KinematicState ownKS, SObstacleAvoidance info) { Ray l_ray = new Ray(ownKS.m_position, ownKS.m_linearVelocity.normalized); RaycastHit l_hitInfo; if (Physics.Raycast(l_ray, out l_hitInfo, info.m_avoidDistance)) { SURROGATE_TARGET.position = l_hitInfo.point + l_hitInfo.normal * info.m_avoidDistance; return(Seek.GetSteering(ownKS, SURROGATE_TARGET)); } l_ray = new Ray(ownKS.m_position, MathExtent.AngleToVector(MathExtent.VectorToAngle(ownKS.m_linearVelocity.normalized) + info.m_AngleSecondWhisk)); if (Physics.Raycast(l_ray, out l_hitInfo, info.m_primaryWhiskerLenght * info.m_RatioSecondWhisk)) { SURROGATE_TARGET.position = l_hitInfo.point + l_hitInfo.normal * info.m_avoidDistance; return(Seek.GetSteering(ownKS, SURROGATE_TARGET)); } l_ray = new Ray(ownKS.m_position, MathExtent.AngleToVector(MathExtent.VectorToAngle(ownKS.m_linearVelocity.normalized) - info.m_AngleSecondWhisk)); if (Physics.Raycast(l_ray, out l_hitInfo, info.m_primaryWhiskerLenght * info.m_RatioSecondWhisk)) { SURROGATE_TARGET.position = l_hitInfo.point + l_hitInfo.normal * info.m_avoidDistance; return(Seek.GetSteering(ownKS, SURROGATE_TARGET)); } return(NULL_STEERING); }
public void SetInfo(float seekWeight, SWander wander, SObstacleAvoidance obstacleAvoidance, SSeek seekInfo) { m_seekWeight = seekWeight; m_seekInfo = seekInfo; m_wanderInfo = wander; m_obstacleAvoidanceInfo = obstacleAvoidance; obstacleAvoided = false; }
public void SetInfo(SObstacleAvoidance info) { m_info = info; }
public static SteeringOutput GetSteering(KinematicState ownKS, ref SWander wanderInfo, SObstacleAvoidance obstacleInfo, ref bool obstacleAvoided) { SteeringOutput obstacleAvoidSteering = ObstacleAvoidance.GetSteering(ownKS, obstacleInfo); if (obstacleAvoidSteering != NULL_STEERING) { obstacleAvoided = true; return(obstacleAvoidSteering); } obstacleAvoided = false; return(Wander.GetSteering(ownKS, ref wanderInfo)); }
public void SetInfo(SWander wander, SObstacleAvoidance obstacleAvoidance) { m_wanderInfo = wander; m_obstacleAvoidanceInfo = obstacleAvoidance; obstacleAvoided = false; }