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

Expand

简介

expand 方法可以将当前 AABB(轴对齐包围盒)对象扩展到包含另一个 AABBVector3 对象。

语法

expand(other)

参数

  • other:必需。要包含在当前 AABB 中的另一个 AABBVector3 对象。

返回值

返回值为 void

示例

import { AABB, Vector3 } from 'yuka';

const aabb = new AABB( new Vector3( -1, -1, -1 ), new Vector3( 1, 1, 1 ) );

// 创建一个新的向量对象
const v = new Vector3( 2, 3, 4 );

// 将向量对象扩展至包含AABB
aabb.expand( v );

// 输出结果:(-1, -1, -1) - (2, 3, 4)
console.log( aabb.min, aabb.max );

以上代码创建了一个 AABB 对象,表示一个边长为 2 的立方体。然后创建了一个 Vector3 对象,并将它扩展到包含该 AABB。最后,通过访问 AABB 对象的 minmax 属性,可以得到扩展后的包围盒范围。