From 65311089798741484d41e64b08182a3e948b3a87 Mon Sep 17 00:00:00 2001 From: Kbscript Date: Sat, 3 Aug 2024 00:22:10 +0800 Subject: [PATCH] fix: fix markdown syntax --- docs/en/physics/controller.md | 6 +++++- docs/zh/physics/controller.md | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/en/physics/controller.md b/docs/en/physics/controller.md index bd96a7b307..425d212d96 100644 --- a/docs/en/physics/controller.md +++ b/docs/en/physics/controller.md @@ -20,6 +20,7 @@ Like collider components, a `ColliderShape` is constructed and added to the comp 2. Currently, character controllers only support `CapsuleColliderShape` and `BoxColliderShape`, with `CapsuleColliderShape` being the most commonly used. The behavior of the character controller can be controlled through the parameters and methods of `CharacterController`, with the most important one being the `move` function: + ```typescript class Controller extends Script { onPhysicsUpdate() { @@ -32,9 +33,10 @@ class Controller extends Script { this._displacement.setValue(0, 0, 0); } } -```` +``` In the `move` method, you can specify the character's displacement, and this method returns an enum type composite value. By using the enum type `ControllerCollisionFlag`, you can determine if the character controller collides with other collider components: + ```typescript export enum ControllerCollisionFlag { /** Character is colliding to the sides. */ @@ -45,5 +47,7 @@ export enum ControllerCollisionFlag { Down = 4 } ``` + Based on this, the character's subsequent animations and movements can be determined. In the example below, you can control the character's movement using the keyboard to make it climb or jump over specific obstacles. + diff --git a/docs/zh/physics/controller.md b/docs/zh/physics/controller.md index d47aeea928..1f8e0b0bd6 100644 --- a/docs/zh/physics/controller.md +++ b/docs/zh/physics/controller.md @@ -20,6 +20,7 @@ characterController.addShape(physicsCapsule); 2. 角色控制器目前只支持 `CapsuleColliderShape` 和 `BoxColliderShape`,且其中 `CapsuleColliderShape` 最为常用。 后续角色控制器的行为通过 `CharacterController` 的各个参数和方法进行控制,其中最重要的是 `move` 函数: + ```typescript class Controller extends Script { onPhysicsUpdate() { @@ -32,9 +33,10 @@ class Controller extends Script { this._displacement.setValue(0, 0, 0); } } -```` +``` 可以在 `move` 方法中指定角色位移,并且该方法返回一个枚举类型的复合值,通过该枚举类型 `ControllerCollisionFlag` 可以判断角色控制器是否碰到其他的碰撞器组件: + ```typescript export enum ControllerCollisionFlag { /** Character is colliding to the sides. */ @@ -45,5 +47,7 @@ export enum ControllerCollisionFlag { Down = 4 } ``` + 由此角色接下来的动画和运动要怎么进行。在下面的例子当中,可以通过键盘控制角色的运动,使其爬上或者跳过特定的障碍物。 +