Skip to content

Commit 37a2765

Browse files
committed
style: Optimize the code comments.(优化代码注释)
1 parent 8bd4ca9 commit 37a2765

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

src/layaAir/Laya.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import { VertexMesh } from "./laya/RenderEngine/RenderShader/VertexMesh";
3737

3838
/**
3939
* @en Laya is the reference entry for global objects.
40-
* @en The Laya class refers to some commonly used global objects, such as Laya.stage: stage, Laya.timer: time manager, Laya.loader: loading manager. Pay attention to case when using.
40+
* - The Laya class refers to some commonly used global objects, such as Laya.stage: stage, Laya.timer: time manager, Laya.loader: loading manager. Pay attention to case when using.
4141
* @zh Laya是全局对象的引用入口集。
42-
* @zh Laya类引用了一些常用的全局对象,比如Laya.stage:舞台,Laya.timer:时间管理器,Laya.loader:加载管理器,使用时注意大小写。
42+
* - Laya类引用了一些常用的全局对象,比如Laya.stage:舞台,Laya.timer:时间管理器,Laya.loader:加载管理器,使用时注意大小写。
4343
*/
4444
export class Laya {
4545
/**

src/layaAir/laya/d3/physics/PhysicsCollider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class PhysicsCollider extends PhysicsColliderComponent {
4242
}
4343

4444
/**
45-
* @en If this collider is a trigger.
46-
* @zh 此碰撞器是否为触发器。
45+
* @en If this collider is a trigger. A trigger will trigger events but not produce actual physical blocking effects.
46+
* @zh 此碰撞器是否为触发器。触发器会触发事件但不会产生实际的物理阻挡效果。
4747
*/
4848
get isTrigger(): boolean {
4949
return this._isTrigger;

src/layaAir/laya/d3/physics/PhysicsColliderComponent.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ export class PhysicsColliderComponent extends Component {
8989
protected _eventsArray: string[];
9090

9191
/**
92-
* @en The collider object.
93-
* @zh 碰撞器对象。
92+
* @en The collider object. Used to access the underlying physics engine's collider object and directly operate on the underlying physics engine's collision characteristics.
93+
* @zh 碰撞器对象。用于访问底层物理引擎的碰撞器对象,直接操作底层物理引擎的碰撞特性。
9494
*/
9595
get collider(): ICollider {
9696
return this._collider;
9797
}
9898

9999
/**
100-
* @en The restitution of the collider (also known as bounciness).
101-
* @zh 碰撞器的弹力(也叫Bounciness)
100+
* @en The restitution coefficient is a key parameter in the physics engine that controls the elasticity of object collisions.
101+
* @zh 恢复系数是物理引擎中控制物体碰撞弹性程度的关键参数,在中文物理学术语中也被称为"弹性系数"或"反弹系数"
102102
*/
103103
get restitution(): number {
104104
return this._restitution;
@@ -112,8 +112,8 @@ export class PhysicsColliderComponent extends Component {
112112
}
113113

114114
/**
115-
* @en The friction of the collider.
116-
* @zh 碰撞器的摩擦力。
115+
* @en The friction of the collider defines the friction coefficient of the object's surface, affecting the difficulty of the object sliding on the contact surface. The larger the value, the greater the friction, making it harder for the object to slide.
116+
* @zh 碰撞器的摩擦力。用于定义物体表面的摩擦系数,影响物体在接触面上滑动的难易程度。值越大,摩擦力越大,物体越难以滑动。
117117
*/
118118
get friction(): number {
119119
return this._friction;
@@ -130,8 +130,8 @@ export class PhysicsColliderComponent extends Component {
130130
}
131131

132132
/**
133-
* @en The rolling friction of the collider.
134-
* @zh 碰撞器的滚动摩擦力。
133+
* @en The rolling friction of the collider. Controls the resistance of an object as it rolls on a surface, affecting how quickly the object slows down when rolling. The larger the value, the faster the object's roll deceleration.
134+
* @zh 碰撞器的滚动摩擦力。用于控制物体在表面上滚动时的阻力,影响物体的滚动减速速率。值越大,物体滚动减速越快。
135135
*/
136136
get rollingFriction(): number {
137137
return this._rollingFriction;
@@ -148,8 +148,8 @@ export class PhysicsColliderComponent extends Component {
148148
}
149149

150150
/**
151-
* @en The dynamic friction of the collider.
152-
* @zh 碰撞器的动态摩擦力。
151+
* @en The dynamic friction of the collider. Defines the friction coefficient of an object when it is already in motion.
152+
* @zh 碰撞器的动态摩擦力。定义物体在已经运动状态下的摩擦系数。
153153
*/
154154
get dynamicFriction(): number {
155155
return this._dynamicFriction;
@@ -162,8 +162,8 @@ export class PhysicsColliderComponent extends Component {
162162
}
163163

164164
/**
165-
* @en The static friction of the collider.
166-
* @zh 碰撞器的静态摩擦力。
165+
* @en The static friction of the collider. Defines the friction coefficient of an object when it is stationary, resisting its movement. Typically greater than or equal to dynamic friction.
166+
* @zh 碰撞器的静态摩擦力。定义物体在静止状态时抵抗开始移动的摩擦系数。通常大于或等于动态摩擦力。
167167
*/
168168
get staticFriction(): number {
169169
return this._staticFriction;
@@ -208,7 +208,7 @@ export class PhysicsColliderComponent extends Component {
208208
* - Minimum: The minimum friction coefficient of the two objects is used.
209209
* - Maximum: The maximum friction coefficient of the two objects is used.
210210
* - Multiply: The friction coefficients of the two objects are multiplied to get the final friction coefficient.
211-
* @zh 弹力组合模式,用于定义在两个物体发生碰撞时,如何组合它们的弹力系数,以确定最终的弹力
211+
* @zh 恢复系数(弹力)组合模式,用于定义在两个物体发生碰撞时,如何组合它们的恢复系数,以确定最终的反弹效果
212212
* 值为:
213213
* - Average(平均值):两个物体的摩擦系数取平均值。
214214
* - Minimum(最小值):使用两个物体摩擦系数中的最小值。
@@ -227,8 +227,8 @@ export class PhysicsColliderComponent extends Component {
227227
}
228228

229229
/**
230-
* @en The collider shape of the physics collider.
231-
* @zh 物理碰撞器的碰撞形状。
230+
* @en The collider shape of the physics collider. Used to set the geometric shape used by a physics collider, such as box, sphere, capsule, etc., defining the physical boundaries of an object.
231+
* @zh 物理碰撞器的碰撞形状。用于设置物理碰撞器使用的几何形状,如盒体、球体、胶囊体等,用于定义物体的物理边界。
232232
*/
233233
get colliderShape(): Physics3DColliderShape {
234234
return this._colliderShape;
@@ -246,8 +246,8 @@ export class PhysicsColliderComponent extends Component {
246246
}
247247

248248
/**
249-
* @en The collision group this collider belongs to.
250-
* @zh 此碰撞器所属的碰撞组。
249+
* @en The collision group this collider belongs to, used to control which objects can collide with it based on bitwise operations.
250+
* @zh 此碰撞器所属的碰撞组,用于控制哪些物体可以与之碰撞,基于位掩码实现
251251
*/
252252
get collisionGroup(): number {
253253
return this._collisionGroup;

src/layaAir/laya/d3/physics/Rigidbody3D.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Rigidbody3D extends PhysicsColliderComponent {
2020
/** @internal */
2121
private _mass = 1.0;
2222
/** @internal */
23-
private _gravity = new Vector3(0, -10, 0);
23+
private _gravity = new Vector3(0, -9.8, 0);
2424
/** @internal */
2525
private _angularDamping = 0.0;
2626
/** @internal */
@@ -55,8 +55,8 @@ export class Rigidbody3D extends PhysicsColliderComponent {
5555
}
5656

5757
/**
58-
* @en The mass of the rigidbody.
59-
* @zh 刚体的质量。
58+
* @en The mass of the rigidbody. It affects the size of acceleration and momentum transfer during force application in collisions.
59+
* @zh 刚体的质量。影响其受力时的加速度大小和在碰撞中的动量传递。
6060
*/
6161
get mass(): number {
6262
return this._mass;
@@ -71,7 +71,7 @@ export class Rigidbody3D extends PhysicsColliderComponent {
7171

7272
/**
7373
* @en Determines if the rigidbody is kinematic. If true, the rigidbody can only be moved by transform property, not by other force-related properties.
74-
* @zh 确定刚体是否为运动物体。如果为true仅可通过transform属性移动物体,而非其他力相关属性。
74+
* @zh 设置刚体是否为运动学控制模式。如果为true仅可通过transform属性移动物体,而非其他力相关属性。
7575
*/
7676
get isKinematic(): boolean {
7777
return this._isKinematic;
@@ -85,8 +85,8 @@ export class Rigidbody3D extends PhysicsColliderComponent {
8585
}
8686

8787
/**
88-
* @en The linear damping of the rigidbody.
89-
* @zh 刚体的线阻力
88+
* @en The linear damping of the rigidbody. It simulates air resistance and other environmental factors to make the object slow down gradually.
89+
* @zh 控制刚体线性运动的阻尼系数,模拟空气阻力等环境因素,使物体逐渐减速
9090
*/
9191
get linearDamping(): number {
9292
return this._linearDamping;
@@ -100,8 +100,8 @@ export class Rigidbody3D extends PhysicsColliderComponent {
100100
}
101101

102102
/**
103-
* @en The angular damping of the rigidbody.
104-
* @zh 刚体的角阻力。
103+
* @en The angular damping of the rigidbody. It simulates angular resistance and other environmental factors to make the object's rotation slow down gradually.
104+
* @zh 刚体的角阻力。控制刚体旋转运动的阻尼系数,使旋转逐渐减速,防止永久旋转。
105105
*/
106106
get angularDamping(): number {
107107
return this._angularDamping;
@@ -115,8 +115,8 @@ export class Rigidbody3D extends PhysicsColliderComponent {
115115
}
116116

117117
/**
118-
* @en The gravity applied to the rigidbody.
119-
* @zh 应用于刚体的重力
118+
* @en Sets the gravity vector applied to the rigidbody, allowing customization of direction and magnitude.
119+
* @zh 设置作用于刚体的重力向量,可自定义方向和大小
120120
*/
121121
get gravity(): Vector3 {
122122
return this._gravity;
@@ -131,7 +131,7 @@ export class Rigidbody3D extends PhysicsColliderComponent {
131131

132132
/**
133133
* @en The linear motion scaling factor for each axis of the rigidbody. If the value of any axis is 0, it means that the linear motion is frozen on that axis.
134-
* @zh 刚体每个轴的线性运动缩放因子。如果某一轴的值为0表示冻结在该轴的线性运动。
134+
* @zh 限制刚体在特定轴向的线性运动, 如果某一轴的值为0表示冻结在该轴的线性运动。
135135
*/
136136
get linearFactor(): Vector3 {
137137
return this._linearFactor;
@@ -165,7 +165,7 @@ export class Rigidbody3D extends PhysicsColliderComponent {
165165

166166
/**
167167
* @en The angular motion scaling factor for each axis of the rigidbody. If the value of any axis is 0, it means that the angular motion is frozen on that axis.
168-
* @zh 刚体每个轴的角度运动缩放因子。如果某一轴的值为0表示冻结在该轴的角度运动。
168+
* @zh 限制刚体在特定轴向的旋转运动,如果某一轴的值为0表示冻结在该轴的角度运动。
169169
*/
170170
get angularFactor(): Vector3 {
171171
return this._angularFactor;
@@ -233,8 +233,8 @@ export class Rigidbody3D extends PhysicsColliderComponent {
233233
}
234234

235235
/**
236-
* @en If the rigidbody is a trigger.
237-
* @zh 刚体是否为触发器
236+
* @en Sets whether the rigidbody is a trigger. Triggers can detect collisions but do not produce physical reactions.
237+
* @zh 设置刚体是否作为触发器使用。触发器可以检测碰撞但不产生物理反应
238238
*/
239239
public get trigger(): boolean {
240240
return this._trigger;

0 commit comments

Comments
 (0)