This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
godot_notes [2024/03/18 11:25] admin |
— (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> | ||
- | - In the world scene, drag the player scene into the world | ||
- | - In the three dot menu (world scene), use 'Add Sun to scene', 'add environment to scene' | ||
- | - In the player scene, use the Mesh button to add a 'Simplified Convext Collision Sibling' mesh to the player's MeshInstance3D | ||
- | - Set up WASD controls in the Project Settings | ||
- | |||
- | ==== Part 3 ==== | ||
- | - Import a texture by dragging it into the file system. | ||
- | - Select a wall. Use Geometry -> Material Override. Select New StandardMaterial3D. Click the sphere. Expand Albedo. Drag the texture to the 'Texture' input. | ||
- | - Find UV1, experiment with the sizing, approx 30 x 10 | ||
- | - Apply to floor/other walls. | ||
- | |||
- | ==== Part 4 ==== | ||