User Tools

Site Tools


godot_notes

This is an old revision of the document!


Part 1

  1. New scene: click 3D Scene, rename to 'world'
  2. Create floor. Add MeshInstance3D to scene
  3. Set Mesh type to 'New PlaneMesh'
  4. Change size. Transform → scale to 20
  5. 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.
  6. New wall. Create another new mesh. This time the Mesh should be New BoxMesh'. Move walls to edge, set z to 20
  7. Tweak the wall height, 'y to the sky', set to 10
  8. Duplicate for the other three walls

Part 2

  1. New scene. Click + next to the world scene. Other node. Search for CharacterBody3D. Name it 'player'.
  2. Add subnode. Click +, search for MeshInstance3D. Set Mesh shape to Capsule shape.
  3. Fix the height. Transform, adjust Y to 1m.
  4. Select player node, add new node, Camera3D.
  5. Adjust Camera height to eye height.
  6. Create script. Select player node. Use script+/scroll button. Select a template for Basic movement.
  7. Add new variable. const TURN_SPEED = 0.05
  8. Add new 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)
godot_notes.1710759397.txt.gz · Last modified: 2024/03/18 10:56 by admin