Megalomaniak
Hey there Mega, thank you very much for replying to my post. Absolutely, I'd be happy to share more information. I brought my laptop to work just in case.
I'm actually not using heavy physics, yet. Just the following:
- CSGBox3D
- CSGMesh3D (for the floor) with collision on.
- The Player
When you mean if the stuttering occurs in _physics_process or _process, I got to be honest, I'm not very sure, but I can share the code below, it's very short. I am calling move_and_slide in _physics_process() though.
1) Main Scene

The project starts off with this scene. I'm using a Subviewport | VIewport since I plan on doing some post processing effects. Not yet though.
You'll notice the PlayerCamera is on its own, however the Player Scene, located in the Sandbox scene, picks up the Camera and uses it.
Let's look at that real quick:

As you all can see, my player is not a complicated setup, just a CharacterBody3D and its collider. Let me go ahead and share the code though, it's not very long:
extends CharacterBody3D
@export var run_speed: float = 3.0
var _current_speed: float
var _look_axis: Vector2
var _rotation_velocity: Vector2
var _direction: Vector3 = Vector3.ZERO
var _movement_velocity: Vector3 = Vector3.ZERO
@onready var _body_collider: CollisionShape3D = $"BodyCollider"
@onready var _head: Node3D = $"Head"
var _camera: Camera3D
func _ready () -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
_camera = find_parent("SubViewport").find_child("PlayerCamera")
_current_speed = run_speed
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
_look_axis = event.relative
func _process(delta: float) -> void:
_update_camera(delta)
_update_direction()
_reset()
func _physics_process(_delta: float) -> void:
velocity = _movement_velocity
move_and_slide()
_camera.global_position.x = global_position.x
_camera.global_position.z = global_position.z
_camera.global_position.y = _head.position.y
func _update_camera(delta: float) -> void:
_rotation_velocity = _rotation_velocity.lerp(_look_axis * 0.3, delta * 13.0)
_head.rotate_x(-deg_to_rad(_rotation_velocity.y)) # Pitch
rotate_y(-deg_to_rad(_rotation_velocity.x)) # Yaw
_head.rotation_degrees.x = clamp(_head.rotation_degrees.x, -90.0, 90.0)
_camera.global_position.y = _head.global_position.y
_camera.rotation_degrees.x = _head.rotation_degrees.x
_camera.rotation.y = rotation.y
func _update_direction () -> void:
var move_input: Vector2 = Vector2.ZERO
move_input.x = Input.get_action_strength("Move Right") - Input.get_action_strength("Move Left")
move_input.y = Input.get_action_strength("Move Backward") - Input.get_action_strength("Move Forward")
move_input = move_input.normalized()
_direction = transform.basis * Vector3(move_input.x, 0.0, move_input.y)
_movement_velocity = _direction * _current_speed
func _reset () -> void:
_look_axis = Vector2.ZERO
That's all. That' the game so far 😃
In terms of project settings:
- I just made sure Vsync is ENABLED which I believe it is by default
- Viewport Width/Height is set to 1280x720 and the mode is Windowed.
Physics Ticks Per Second was left at the default 60. Nothing else was changed.
I also forgot to mention in my post, I ran nvidia-smi in the terminal I get the following:
NVIDIA-SMI 525.85.05 Driver Version: 525.85.05 CUDA Version: 12.0
If you need more information, I can provide anything you need. I'm refreshing this page all the time so I'm here.
Thanks again!