• 3D
  • Look_at and rotation

Hi there,

I have this code, a rotation is applied and the object continue rotating as i keep pressing a key. rotation = oldRotation

Adding look_at, the objects look at the vector. But the next line of code changing rotation is no more applied the same way , the objects only rotates 10° if i keep pressing a key, when i release the key , the rotation is reset.

look_at(transform.basis.z, normalMedium) rotation = oldRotation

Does look_at is a function that is called after all other spatial functions are called , so it overrides any next functions calls ? It's really strange.

I think look_at rotates as soon as you call it (or at least, it has for me with my IK plugin). Can you post some example/sample code for debugging?

What i try to achieve is an arcade bike gameplay. It needs to align to floor normal and follow Y rotation the player inputs. I done that in the past and followed some tutorials, it should be easy but i'm missing something in Godot.

Well, I've look at it and despite my best efforts, I cannot get it working either. look_at is giving strange results, at least not the results I was expecting.

I'll look at this some more later!

@TwistedTwigleg said: Well, I've look at it and despite my best efforts, I cannot get it working either. look_at is giving strange results, at least not the results I was expecting.

I'll look at this some more later!

I was trying look_at for something in another project and i also got very strange results with position and scale change. There must be some bug with that function, i avoid it and use simple math instead until we got a function like align_to instead.

Yeah, that's probably best for now. Hopefully things will be fixed in the future.