var angularspeed = velocity.length()/ballradius
var rotaxisraw = Vector3.UP.cross(velocity)
var rotaxis = rotaxisraw.normalized()
var rotationrads = angularspeed * delta
if rotaxis == Vector3(0,0,0):
rotaxis = Vector3(0,1,0)
sprite_3d.rotate(rotaxis,rotationrads)
mesh_instance_3d.rotate(rotaxis,rotationrads)
As you can see, I have normalized the rotaxis, yet sometimes I get an error saying that the rotaxis needs to be normalized before use. What is going on?
What line are you getting the error on and what is the exact text of the error?
Never use operator == to compare floating point numbers.
1 Like
OK, thanks for the tip. What would you suggest instead?
It errors on the lines where I rotate the Sprite3D and MeshInstance 3D, and it says that rotaxis is not normalized, and provides the axis. The axis does not have a length of 0, as checked by the previous condition (which I’m now being informed is not a good way to handle it).
Copypaste the exact error messages.
To compare floats/vectors use is_equal_approx() or is_zero_approx()
Sorry, not at my setup right now 
I’ll paste the error as soon as I can, which may be an hour or so. Sorry for the delay.