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

clone

方法说明

clone 方法用于复制 Plane 实例。

语法

Plane.clone()

参数说明

clone 方法没有参数。

返回值

返回一个新的 Plane 实例,其属性与原实例相同。

示例

复制实例

var p1 = new Plane({ x: 10, y: 20 });
var p2 = p1.clone();
console.log(p1.x, p1.y); // 10, 20
console.log(p2.x, p2.y); // 10, 20

修改原实例

var p1 = new Plane({ x: 10, y: 20 });
var p2 = p1.clone();
p1.x = 30;
console.log(p1.x, p1.y); // 30, 20
console.log(p2.x, p2.y); // 10, 20

修改新实例

var p1 = new Plane({ x: 10, y: 20 });
var p2 = p1.clone();
p2.x = 30;
console.log(p1.x, p1.y); // 10, 20
console.log(p2.x, p2.y); // 30, 20

备注

clone 方法只复制 Plane 实例本身的属性,不包括原型链上的属性。如果需要复制原型链上的属性,可以通过 Object.assign 或类似方法实现。