This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I've been at this for nearly three days straight now (16 hours+ daily). Godot transforms are slapping me across the face.

First I wanted to use Mixamo animations in Godot. This was torturous, and through pure trial and error I finally came up with a workflow that succeeded.

Then I got to work on a very simple third-person character controller.

enter code here extends KinematicBody

var curHp : int = 10
var maxHp : int = 10
var damage : int = 1

var gold : int = 0
var attackRate : float = 0.3
var lastAttackTime : int = 0

export var moveSpeed : float = 5.0
export var jumpForce : float = 10.0
export var gravity : float = 15.0
export var upForce: float = 3.0
export var vel : Vector3 = Vector3()

onready var camera = get_node("CameraOrbit")

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

func _physics_process(delta):
vel.x = 0
vel.z = 0

var input = Vector3()

if Input.is_action_pressed("move_forward"):
    input.z -= 1
if Input.is_action_pressed("move_backward"):
    input.z += 1
if Input.is_action_pressed("move_left"):
    input.x -= 1
if Input.is_action_pressed("move_right"):
    input.x += 1

input = input.normalized()

var dir = (transform.basis.z * input.z + transform.basis.x * input.x)

vel.x = dir.x * moveSpeed
vel.z = dir.z * moveSpeed

# gravity
vel.y -= gravity * delta

if Input.is_action_pressed("move_jump") and is_on_floor():
    vel.y = jumpForce

#move along the current velocity
vel = move_and_slide(vel, Vector3.UP)
# transform = transform.orthonormalized()

func divideButAvoidZero(divisor, dividend):
if divisor == 0:
    return 0
    return dividend / divisor

It was working well.

I then created four 1 frame animations that rotated (transform) the player model.
I put all four animations into two 1 dimensional blend spaces and then used the add node to combine them with the idle animation.

This worked fine, but after flying around for a bit in the game the animations invert (moving right plays left-leaning animation instead).

Very shortly afterwards the camera movement inverts as well (moving the mouse up makes the camera look down).

I believe that I am unknowingly messing up the transform basis of the character controller, but I don't know how, why or when. I've never been this stuck on anything before.

Does this sound familiar to anyone?

Here is the link to the repository

Godot version Godot 3.4.4
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.