AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

intersectsPlane

功能

判断立方体轴对齐包围盒(AABB)是否与平面相交。

语法

Yuka.Math.intersectsPlane( box, plane )

参数

  • box - 必选。表示立方体轴对齐包围盒的对象,包含以下属性:
    • min - 必选。一个包含 x、y、z 坐标的向量,表示立方体轴对齐包围盒的最小边界。
    • max - 必选。一个包含 x、y、z 坐标的向量,表示立方体轴对齐包围盒的最大边界。
  • plane - 必选。表示平面的对象,包含以下属性:
    • normal - 必选。一个包含 x、y、z 坐标的向量,表示平面的法向量。
    • constant - 必选。表示平面方程的常数项。

返回值

  • 如果立方体轴对齐包围盒和平面相交,则返回 true;否则,返回 false

示例代码

const box = {
  min: new Yuka.Vector3( -1, -1, -1 ),
  max: new Yuka.Vector3( 1, 1, 1 )
};

const plane = {
  normal: new Yuka.Vector3( 0, 1, 0 ),
  constant: 0
};

if ( Yuka.Math.intersectsPlane( box, plane ) ) {
  console.log( 'Box intersects plane.' );
}

参考

  • https://threejs.org/docs/#api/en/math/Box3.intersectsPlane