This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Look_at and rotation

MagicLordMagicLord Posts: 578Unconfirmed
edited March 2018 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: 2,561Admin

    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 2018

    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: 2,561Admin

    Cool, I’ll look at this soon!

  • TwistedTwiglegTwistedTwigleg Posts: 2,561Admin

    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: 2,561Admin

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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.