Whether the component is a singleton, meaning only one instance of this type of script can be added to the same node.
Zh
是否为单例,即同一个节点只能添加此类型的脚本一次。
anchor
anchor:any[] = ...
En
Link points of joints, it is offset from the position of the upper left corner of its own rigid body. This setting is effective only on the first assignment.
Zh
[首次设置有效]关节的链接点,是相对于自身刚体的左上角位置偏移。
collideConnected
collideConnected:boolean = false
En
Specifies whether the two connected rigid bodies can collide with each other. Default is false. This setting is effective only on the first assignment.
The rigid body that is locally attached to the joint. This setting is effective only on the first assignment.
Zh
[首次设置有效]与关节直接相连的自身刚体。
访问器
awaked
getawaked():boolean
返回 boolean
En
whether the component has been awakened.
Zh
组件是否已经被唤醒。
destroyed
getdestroyed():boolean
返回 boolean
En
whether the component has been destroyed.
Zh
组件是否已经被销毁。
enabled
getenabled():boolean
返回 boolean
En
whether the component is enabled.
Zh
是否启用组件。
setenabled(value:boolean):void
参数
value: boolean
返回 void
enableLimit
getenableLimit():boolean
返回 boolean
En
Whether to constrain the rotation range of the rigid body
Zh
是否对刚体的旋转范围加以约束
setenableLimit(value:boolean):void
参数
value: boolean
返回 void
enableMotor
getenableMotor():boolean
返回 boolean
En
Enables or disables the motor, which when enabled, drives the rotation of the target body.
Zh
启用或禁用马达,启用后可以驱动目标刚体的旋转。
setenableMotor(value:boolean):void
参数
value: boolean
返回 void
hideFlags
gethideFlags():number
返回 number
En
The hide flags that determine the hiding behavior of the component.
Zh
确定组件隐藏行为的标志。
sethideFlags(value:number):void
参数
value: number
返回 void
id
getid():number
返回 number
En
The unique identifier for the component.
Zh
组件的唯一标识。
joint
getjoint():any
返回 any
En
[read-only] Native joint object.
Zh
[只读]原生关节对象。
lowerAngle
getlowerAngle():number
返回 number
En
The lower limit angle of the rotation range when the limit is enabled.
Zh
启用限制后,刚体旋转范围的下限角度。
setlowerAngle(value:number):void
参数
value: number
返回 void
maxMotorTorque
getmaxMotorTorque():number
返回 number
En
The maximum torque that can be applied when the motor is enabled. Insufficient torque may result in no rotation.
Zh
启用马达后可以施加的最大扭距。如果最大扭矩太小,可能导致不旋转。
setmaxMotorTorque(value:number):void
参数
value: number
返回 void
motorSpeed
getmotorSpeed():number
返回 number
En
The maximum rotational speed that can be achieved when the motor is enabled.
Zh
启用马达后可以达到的最大旋转速度。
setmotorSpeed(value:number):void
参数
value: number
返回 void
upperAngle
getupperAngle():number
返回 number
En
The upper limit angle of the rotation range when the limit is enabled.
Zh
启用限制后,刚体旋转范围的上限角度。
setupperAngle(value:number):void
参数
value: number
返回 void
方法
destroy
destroy():void
返回 void
En
Destroy components
Zh
销毁组件
hasHideFlag
hasHideFlag(flag:number):boolean
参数
flag: number
The hide flag to check for.
返回 boolean
En
Checks if the component has a specific hide flag set.
Zh
检查组件是否设置了特定的隐藏标志。
onAdded
onAdded():void
返回 void
En
Called after the component is added to a node. Unlike Awake, onAdded is called even if the node is not active.
Zh
组件被添加到节点后调用,与 onAwake 不同的是,即使节点未激活也会调用 onAdded。
onAwake
onAwake():void
返回 void
En
Executed after the component is activated. At this point, all nodes and components have been created. This method is executed only once.
Zh
组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次。
onDestroy
onDestroy():void
返回 void
En
Executed when the node is destroyed manually.
Zh
手动调用节点销毁时执行。
onDisable
onDisable():void
返回 void
En
Executed when the component is disabled, such as when the node is removed from the stage.
Zh
组件被禁用时执行,比如从节点从舞台移除后。
onEnable
onEnable():void
返回 void
En
Executed after the component is enabled, such as when the node is added to the stage.
Zh
组件被启用后执行,比如节点被添加到舞台后。
可选onLateUpdate
onLateUpdate():void
返回 void
En
Executed every frame during the late update phase, after the update phase.
Zh
每帧更新时执行,在 late update 阶段,update 阶段之后。
可选onPostRender
onPostRender():void
返回 void
En
Executed after rendering.
Zh
渲染之后执行。
可选onPreRender
onPreRender():void
返回 void
En
Executed before rendering.
Zh
渲染之前执行。
可选onReset
onReset():void
返回 void
En
Resets the component's parameters to their default values. If this function is implemented, the component will be reset and automatically recycled for future use.
If not reset, it will not be recycled for reuse.
En
Rotating joint forces two objects to share an anchor point, and the two objects rotate relative to each other
Zh
旋转关节强制两个物体共享一个锚点,两个物体相对旋转