Player: shape, layers and input
A CharacterBody3D prefab, separate Visual, hit area and exact input action names.
Prefab
Use File → Create Prefab… with a CharacterBody3D root, name it Player and save Prefabs/Player.rprefab:
Player (CharacterBody3D, SquashPlayer.cs)
├── CollisionShape3D
├── Visual (Entity3D, LandingPulse.cs)
│ └── MeshInstance3D
└── MobDetector (Area3D)
└── CollisionShape3DThe main CollisionShape3D uses a CapsuleShape3D, Radius 0.35, Height 1.8. Give Visual/MeshInstance3D a matching CapsuleMesh and blue StandardMaterial3D. Keep Visual at local position 0 and scale 1. Attach the animation script to Visual, not the body.
Set MobDetector Position to (0, -0.1, 0), with Monitoring on and a child BoxShape3D of size (0.8, 1.6, 0.8). This gameplay detector is slightly wider than the physics capsule and detects close side contact on the floor.
Layers and masks
| Object | Enabled layer bits | Enabled mask bits | Numeric values |
|---|---|---|---|
| Floor | 1 | None | 1 / 0 |
| Player | 2 | 1 and 3 | 2 / 5 |
| Hazard | 3 | 1 | 4 / 1 |
| MobDetector | None | 3 | 0 / 4 |
An inspector layer-button number differs from its numeric bitmask: layer 3 is numeric 4. The player collides with floor and hazards; the area detects only hazards. Hazards do not block one another in this example.
Input Map
Add move_left — A / Left, move_right — D / Right, move_forward — W / Up, move_back — S / Down and jump — Space. Use physical key positions for letters.
Place the player instance in Arena.rscene at (0, 0.9, 0), resting the capsule bottom on the floor. Player.rprefab alone has no floor, camera or UI; test this 3D prefab in the level. See the complete controller.