seemsvanjest you can always use godot to record
https://docs.godotengine.org/en/stable/tutorials/animation/creating_movies.html
6DOF character controller
- Edited
xyz The intended movement control is exactly the same as Space Engineers' jetpack control. Jetpack in space.
The linear motion works exactly as intended, it's just the rotation that's screwy.
For yaw, pitch and roll you should rotate around player's current basis axes
This is the bit that's confusing me. My understanding was that rotate_x/y/z did this. Obviously I was wrong...
kuligs2 Completely forgot that was a thing.
seemsvanjest Well best to find a video example. You can't expect everyone here played Space Engineers The important thing to determine is does it uses full 6 dof or a variant with some limitations.
- Edited
seemsvanjest My understanding was that rotate_x/y/z did this.
rotate_*()
rotates around axes of the parent's coordinate system.
rotate_object_local()
rotates around axes specified in object's local coordinate system.
kuligs2 Current behaviour.
[
After any rotation, linear movement remains along global axes.
- Edited
You can't expect everyone here played Space Engineers
Fair enough.
rotate_object_local() rotates around axes specified in object's local coordinate system.
I was originally using rotate_object_local() with the same results. I switched to rotate_* while trying to fix it.
seemsvanjest After any rotation, linear movement remains along global axes.
Same problem as with rotations. You need to move along player's basis axes, not along parent's x, y, z axes, which your code currently does.
- Edited
- Best Answerset by seemsvanjest
seemsvanjest Here's a simple example of full 6 dof control:
extends Node3D
const MOVE_SPEED = 20.0
const ROTATE_SPEED = PI
const MOUSE_SENSITIVITY = .04
func _input(e):
if e is InputEventMouseMotion:
rotate_object_local(Vector3.UP, -e.relative.x * MOUSE_SENSITIVITY) # yaw
rotate_object_local(Vector3.RIGHT, -e.relative.y * MOUSE_SENSITIVITY) # pitch
func _process(dt):
rotate_object_local(Vector3.FORWARD, Input.get_axis("roll_ccw", "roll_cw") * ROTATE_SPEED * dt) # roll
var vel = Vector3(
Input.get_axis("left", "right"), Input.get_axis("up", "down"), Input.get_axis("forward", "back")
) * MOVE_SPEED
global_position += global_basis * vel * dt
- Edited
xyz Awesome. Thanks for taking the time to help.
seemsvanjest You can still use velocity
and move_and_slide()
. I just used "manual" movement for simplicity.
xyz All working now. It makes a lot more sense after the example. global_basis
was the missing piece of the puzzle for me. Thanks again for your patience and taking the time to post the example.