This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
godot_notes [2024/03/18 10:56] admin created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Part 1 ===== | ||
- | - New scene: click 3D Scene, rename to 'world' | ||
- | - Create floor. Add MeshInstance3D to scene | ||
- | - Set Mesh type to 'New PlaneMesh' | ||
- | - Change size. Transform -> scale to 20 | ||
- | - Create collision mesh. Using the 'Mesh' top button, choose 'Trimesh Static Body'. That automatically creates a StaticBody3D of the correct type, and then adds a CollisionShape3D. | ||
- | - New wall. Create another new mesh. This time the Mesh should be New BoxMesh'. Move walls to edge, set z to 20 | ||
- | - Tweak the wall height, 'y to the sky', set to 10 | ||
- | - Duplicate for the other three walls | ||
- | ===== Part 2 ===== | ||
- | - New scene. Click + next to the world scene. Other node. Search for CharacterBody3D. Name it 'player'. | ||
- | - Add subnode. Click +, search for MeshInstance3D. Set Mesh shape to Capsule shape. | ||
- | - Fix the height. Transform, adjust Y to 1m. | ||
- | - Select player node, add new node, Camera3D. | ||
- | - Adjust Camera height to eye height. | ||
- | - Create script. Select player node. Use script+/scroll button. Select a template for Basic movement. | ||
- | - Add new variable. ''const TURN_SPEED = 0.05'' | ||
- | - Add new code | ||
- | <code> | ||
- | if Input.is_action_pressed("ui_left"): | ||
- | self.rotate_y(TURN_SPEED) | ||
- | if Input.is_action_pressed("ui_right"): | ||
- | self.rotate_y(-TURN_SPEED) | ||
- | </code> |