godot-physics-3d
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese3D Physics (Jolt/Native)
3D物理(Jolt/原生)
Expert guidance for high-performance 3D physics and ragdolls.
针对高性能3D物理与布娃娃系统的专家级指南。
NEVER Do
绝对禁止操作
- NEVER scale RigidBody3D — Scale collision shapes, NEVER the body itself. Non-uniform scaling breaks physics engines logic.
- NEVER use inside
move_and_slide— Always use_process. Frame-rate dependency kills simulation stability._physics_process - NEVER simulate ragdolls 24/7 — Only enable physical bones on death or impact. Animate static meshes otherwise to save CPU.
- NEVER ignore Jolt — Godot Jolt plugin is strictly superior to default Godot Physics in 4.x for stability and performance. Use it if possible.
- NEVER use ConcaveCollisionShape3D for dynamic bodies — Concave shapes (Trimesh) are for static ground only. Moving bodies MUST be Convex or Primitive (Box/Capsule).
- 绝对不要缩放RigidBody3D —— 缩放碰撞形状即可,绝对不要缩放刚体本身。非均匀缩放会破坏物理引擎的逻辑。
- 绝对不要在中使用
_process—— 务必在move_and_slide中使用。帧率依赖会破坏模拟的稳定性。_physics_process - 绝对不要24小时不间断模拟布娃娃系统 —— 仅在角色死亡或受撞击时启用物理骨骼,其他时候使用静态网格动画以节省CPU资源。
- 绝对不要忽略Jolt —— Godot 4.x版本中,Godot Jolt插件在稳定性和性能上远优于默认的Godot物理引擎,如有可能请优先使用。
- 绝对不要对动态刚体使用ConcaveCollisionShape3D —— 凹形形状(三角形网格)仅适用于静态地面,运动刚体必须使用凸形或基础形状(立方体/胶囊体)。
Available Scripts
可用脚本
ragdoll_manager.gd
ragdoll_manager.gd
Expert manager for transitioning Skeleton3D from animation to physical simulation (death effect). Handles impulse application and cleanup.
用于处理Skeleton3D从动画到物理模拟(死亡效果)过渡的专业管理器,可处理冲量应用与资源清理。
raycast_visualizer.gd
raycast_visualizer.gd
Debug tool to visualize hit points and normals of RayCast3D in game.
用于在游戏中可视化RayCast3D的命中点与法向量的调试工具。
Core Architecture
核心架构
1. Layers & Masks (3D)
1. 层与掩码(3D)
Same as 2D:
- Layer: What object IS.
- Mask: What object HITS.
和2D逻辑一致:
- 层(Layer):标识物体的属性类别。
- 掩码(Mask):标识物体可碰撞检测的对象类别。
2. Physical Bones (Ragdolls)
2. 物理骨骼(布娃娃系统)
Godot uses nodes attached to bones.
To setup:
PhysicalBone3DSkeleton3D- Select Skeleton3D.
- Click "Create Physical Skeleton" in top menu.
- This generates nodes.
PhysicalBone3D
Godot使用挂载在骨骼上的节点实现相关功能。
设置步骤:
Skeleton3DPhysicalBone3D- 选中Skeleton3D节点。
- 点击顶部菜单的「创建物理骨架」选项。
- 操作完成后会自动生成节点。
PhysicalBone3D
3. Jolt Joints
3. Jolt关节
Use for almost everything. It covers hinge, slider, and ball-socket needs with simpler configuration than specific nodes.
Generic6DOFJoint3D几乎所有场景都可以使用,它可以满足铰链、滑块、球窝等各类需求,相比专用节点配置更简单。
Generic6DOFJoint3DRagdoll Implementation
布娃娃系统实现
gdscript
undefinedgdscript
undefinedsimple_ragdoll.gd
simple_ragdoll.gd
extends Skeleton3D
func start_ragdoll() -> void:
physical_bones_start_simulation()
func stop_ragdoll() -> void:
physical_bones_stop_simulation()
undefinedextends Skeleton3D
func start_ragdoll() -> void:
physical_bones_start_simulation()
func stop_ragdoll() -> void:
physical_bones_stop_simulation()
undefinedReference
参考
- Master Skill: godot-master
- 主技能:godot-master