Look_at and rotation

MagicLordMagicLord Posts: 578Unconfirmed
edited March 30 in 3D

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.

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 897Admin

    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?

  • MagicLordMagicLord Posts: 578Unconfirmed

    @TwistedTwigleg said:
    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?

    You can download the project from github
    https://github.com/DevMagicLord/Godot3/tree/master/debug/racing

    There is lot not needed code from another project i modified, look inside the function
    func race(delta):

  • MagicLordMagicLord Posts: 578Unconfirmed
    edited March 30

    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.

  • TwistedTwiglegTwistedTwigleg Posts: 897Admin

    Cool, I’ll look at this soon!

  • TwistedTwiglegTwistedTwigleg Posts: 897Admin

    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!

  • MagicLordMagicLord Posts: 578Unconfirmed

    @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.

  • TwistedTwiglegTwistedTwigleg Posts: 897Admin

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

Sign In or Register to comment.