0 votes

No issue translating, but rotating at all breaks the viewport and throws the error "det==0" and "setaxisangle: The axis Vector3 must be normalized." The Vector3 I'm trying to rotate it by is normalized, and all of the scales on everything aren't 0, which I've seen has caused the error before.

in Engine by (27 points)

Can you share your code as well?

https://github.com/frenchma/Game-stuff.git

This has all the code in the project

What happens when you use rotate() instead of rotate_object_local()?

the same thing

1 Answer

+3 votes
Best answer

Hi,
a zero vector normalized does not return a proper normalized vector.

Vector3().normalized returns (0,0,0) ... not of length 1

When you start your code, spin_inertia is a zero vector.

when your code depents on a proper normalized vector better make your own fail safe function

func normalize( vec:Vector3 ):
    var newVec = vec.normalized()
    if newVec.length() < 1:
        newVec  = Vector3.UP #or whatever is your default
    return newVec

Not tested!

by (3,932 points)
selected by

Had the same problem, the above function fixed it

I had:

transform.basis = transform.basis.rotated(Vector3.ZERO, pitchinput * pitchspeed * delta)

changed to:

transform.basis = transform.basis.rotated(normalize(Vector3.ZERO), pitchinput * pitchspeed * delta)

no more errors at runtime, works same as previous line, cheers

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 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 webmaster@godotengine.org with your username.