All skills
thedivergentai avatar

/godot-physics-3d

@9d6e91e

Expert patterns for Godot 3D physics (Jolt/PhysX), including Ragdolls, PhysicalBones, Joint3D constraints, RayCasting optimizations, and collision layers. Use for rigid body simulations, character physics, or complex interactions. Trigger keywords: RigidBody3D, PhysicalBone3D, Jolt, Ragdoll, Skeleton3D, Joint3D, PinJoint3D, HingeJoint3D, Generic6DOFJoint3D, RayCast3D, PhysicsDirectSpaceState3D.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-physics-3d

This session only. Nothing lands on disk.

referencesexpert-3d-constraints.md

≈431 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Expert 3D physics constraints

Hover springs, Jolt vehicle suspension, ragdoll blend-back. Scripts: hover_constraint_3d.gd, vehicle_simulation_tuning.gd, ragdoll_blender.gd.

Core Architecture

1. Layers & Masks (3D)

Same as 2D:

  • Layer: What object IS.
  • Mask: What object HITS.

2. Physical Bones (Ragdolls)

Godot uses PhysicalBone3D nodes attached to Skeleton3D bones. To setup:

  1. Select Skeleton3D.
  2. Click "Create Physical Skeleton" in top menu.
  3. This generates PhysicalBone3D nodes.

3. Jolt Joints

Use Generic6DOFJoint3D for almost everything. It covers hinge, slider, and ball-socket needs with simpler configuration than specific nodes.


Ragdoll Implementation


### 4. Custom Physics Constraint Solver (intersect_ray)
For building custom constraints like hover mechanics or custom suspensions, query the physics space directly using `PhysicsDirectSpaceState3D`. Access the space state only during the `_physics_process()` callback to avoid lock errors.

```gdscript
class_name HoverConstraint3D extends RigidBody3D

### 5. Jolt Settings (Vehicle Suspensions)
Jolt Physics is the recommended engine for high-stability 3D physics in Godot 4.x. For vehicle suspensions, tune `suspension_stiffness` and `suspension_travel` to balance stability and realism.

```gdscript
class_name VehicleSuspensionTuner extends VehicleBody3D

### 6. Ragdoll Blending (Revival Interpolation)
Transitioning from a ragdoll back to an animated state involves manipulating the `influence` property of the `PhysicalBoneSimulator3D`. Use a `Tween` to smoothly interpolate influence from 1.0 (physics) to 0.0 (animation).

```gdscript
class_name RagdollBlender extends Node3D

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides a comprehensive set of GDScript templates and expert patterns for Godot Engine 3D physics. It includes implementation details for character movement, ragdolls, vehicle simulation, and performance-oriented physics server usage. The analysis found no security risks, malicious code, or unauthorized data access patterns.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    3/3 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-physics-3d