Godot Version
4.2.1.stable
Question
Firstly, this is my first day using Godot and I don’t know anything, so if there’s anything that should be done differently then let me know.
I’m trying to create a simple ball maze game where you navigate a ball in a maze and collect points or something along the lines - a simple beginner project.
I created a maze thingy in blender, exported the mesh as fbx, imported it to godot, created an inherited scene using the mesh, used the “Create Trimesh Static Body” option and threw it into the main game scene.
I rotate the camera that is a child of a node (orbiting rotation) with the following script:
extends Node3D
@export var rotation_speed = 0.05
@export var rotation_amount = 30
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var curr = Quaternion(transform.basis)
var new_x = 0
var new_z = 0
if Input.is_action_pressed("ui_up"):
new_x += rotation_amount*PI/180
if Input.is_action_pressed("ui_down"):
new_x -= rotation_amount*PI/180
if Input.is_action_pressed("ui_left"):
new_z -= rotation_amount*PI/180
if Input.is_action_pressed("ui_right"):
new_z += rotation_amount*PI/180
var target = Quaternion.from_euler(Vector3(new_x,0,new_z));
transform.basis = Basis(curr.slerp(target,0.05))
Here’s the code that controls the player (ball):
extends RigidBody3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var forceVec = Vector3(0,0,0);
if Input.is_action_pressed("ui_up"):
forceVec+=Vector3(0,0,-1);
if Input.is_action_pressed("ui_down"):
forceVec+=Vector3(0,0,1);
if Input.is_action_pressed("ui_left"):
forceVec+=Vector3(-1,0,0);
if Input.is_action_pressed("ui_right"):
forceVec+=Vector3(1,0,0);
apply_impulse(forceVec)
print(position)
The imported maze mesh doesn’t move nor rotate nor scale nor anything.
But the ball seems to start glitching up/away from thin walls, sometimes just phases through the floor. What should I do?
Video of my issue here (can’t upload attachments as a new user): godotFunky.mp4 | XBackBone