add node.up && node.right (#8643)

* add node.up && node.right

* modify comments

* modify comments

* update

* Update cocos/core/scene-graph/node.ts

Co-authored-by: Santy-Wang <wh19930829@qq.com>

* Update cocos/core/scene-graph/node.ts

Co-authored-by: Santy-Wang <wh19930829@qq.com>

* Update cocos/core/scene-graph/node.ts

Co-authored-by: Santy-Wang <wh19930829@qq.com>

* Update cocos/core/scene-graph/node.ts

Co-authored-by: Santy-Wang <wh19930829@qq.com>

Co-authored-by: Santy-Wang <wh19930829@qq.com>
This commit is contained in:
troublemaker52025
2021-06-10 11:58:06 +08:00
committed by GitHub
parent 8d0e57b0c5
commit 8ceb4beae7
+16
View File
@@ -423,6 +423,22 @@ export class Node extends BaseNode {
this.setWorldRotation(q_a);
}
/**
* @en Return the up direction vertor of this node in world space.
* @zh 返回当前节点在世界空间中朝上的方向向量
*/
get up (): Vec3 {
return Vec3.transformQuat(new Vec3(), Vec3.UP, this.worldRotation);
}
/**
* @en Return the right direction vector of this node in world space.
* @zh 返回当前节点在世界空间中朝右的方向向量
*/
get right (): Vec3 {
return Vec3.transformQuat(new Vec3(), Vec3.RIGHT, this.worldRotation);
}
/**
* @en Layer of the current Node, it affects raycast, physics etc, refer to [[Layers]]
* @zh 节点所属层,主要影响射线检测、物理碰撞等,参考 [[Layers]]