Skip to content

Commit

Permalink
add node.up && node.right (cocos#8643)
Browse files Browse the repository at this point in the history
* add node.up && node.right

* modify comments

* modify comments

* update

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

Co-authored-by: Santy-Wang <[email protected]>

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

Co-authored-by: Santy-Wang <[email protected]>

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

Co-authored-by: Santy-Wang <[email protected]>

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

Co-authored-by: Santy-Wang <[email protected]>

Co-authored-by: Santy-Wang <[email protected]>
  • Loading branch information
troublemaker52025 and SantyWang authored Jun 10, 2021
1 parent 8d0e57b commit 8ceb4be
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cocos/core/scene-graph/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down

0 comments on commit 8ceb4be

Please sign in to comment.