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.

asked Jul 10 in Engine by alskdjfhg (25 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

+2 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!

answered Jul 10 by klaas (620 points)
selected Jul 11 by alskdjfhg
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.