Files
esengine/packages/components/src/RigidBodyComponent.ts
YHH a3f7cc38b1 Feature/render pipeline (#232)
* refactor(engine): 重构2D渲染管线坐标系统

* feat(engine): 完善2D渲染管线和编辑器视口功能

* feat(editor): 实现Viewport变换工具系统

* feat(editor): 优化Inspector渲染性能并修复Gizmo变换工具显示

* feat(editor): 实现Run on Device移动预览功能

* feat(editor): 添加组件属性控制和依赖关系系统

* feat(editor): 实现动画预览功能和优化SpriteAnimator编辑器

* feat(editor): 修复SpriteAnimator动画预览功能并迁移CI到pnpm

* feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm

* feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm

* feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm

* feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm

* feat(ci): 迁移项目到pnpm并修复CI构建问题

* chore: 迁移CI工作流到pnpm并添加WASM构建支持

* chore: 迁移CI工作流到pnpm并添加WASM构建支持

* chore: 迁移CI工作流到pnpm并添加WASM构建支持

* chore: 迁移CI工作流到pnpm并添加WASM构建支持

* chore: 迁移CI工作流到pnpm并添加WASM构建支持

* chore: 迁移CI工作流到pnpm并添加WASM构建支持

* chore: 移除 network 相关包

* chore: 移除 network 相关包
2025-11-23 14:49:37 +08:00

58 lines
1.4 KiB
TypeScript

import { Component, ECSComponent, Serializable, Serialize } from '@esengine/ecs-framework';
/**
* 刚体类型
*/
export enum BodyType {
Static = 'static',
Dynamic = 'dynamic',
Kinematic = 'kinematic'
}
/**
* 刚体组件 - 管理物理模拟
*/
@ECSComponent('RigidBody')
@Serializable({ version: 1, typeId: 'RigidBody' })
export class RigidBodyComponent extends Component {
/** 刚体类型 */
@Serialize() public bodyType: BodyType = BodyType.Dynamic;
/** 质量 */
@Serialize() public mass: number = 1;
/** 线性阻尼 */
@Serialize() public linearDamping: number = 0;
/** 角阻尼 */
@Serialize() public angularDamping: number = 0.05;
/** 重力缩放 */
@Serialize() public gravityScale: number = 1;
/** 是否使用连续碰撞检测 */
@Serialize() public continuousDetection: boolean = false;
/** 是否冻结X轴旋转 */
@Serialize() public freezeRotationX: boolean = false;
/** 是否冻结Y轴旋转 */
@Serialize() public freezeRotationY: boolean = false;
/** 是否冻结Z轴旋转 */
@Serialize() public freezeRotationZ: boolean = false;
/** X轴速度 */
@Serialize() public velocityX: number = 0;
/** Y轴速度 */
@Serialize() public velocityY: number = 0;
/** Z轴速度 */
@Serialize() public velocityZ: number = 0;
constructor() {
super();
}
}