Godot Version
Godot Engine v4.2.1
Question
Hello I’m very new to godot and everything about gamedev.
I’m currently creating a tank shooting game but I’m stuck at the movement.
so to rotate my object/player I used this:
extends CharacterBody3D
@export var rot_speed = 10
func _physics_process(delta: float) → void:
if Input.is_action_pressed(“Left”):
self.rotation.y += delta * rot_speed
if Input.is_action_pressed(“Right”):
self.rotation.y -= delta * rot_speed
I thought rotating it was pretty straight forward so now my next mission was to move the object forward a direction. I thought just adding this would do it:
if Input.is_action_pressed(“Forward”):
self.position.z += delta
if Input.is_action_pressed(“Back”):
self.position.z -= delta
what ended up happening was it wasn’t moving to the object new Z axis position or rotation. I’m guessing I have to update something to get the new position, how do I got about that?