Spatial.look_at() [solved]

hsn678hsn678 Posts: 6Member
edited April 2018 in 3D

Hi,
is it my fault or a bug?
I expected A points to B
see attached scene

Best Answer

  • GarromOrcShamanGarromOrcShaman Posts: 214
    edited April 2018 Accepted Answer

    It is not your fault nor bug. Look_at works just fine. Every 3D models must have defined where is up and where is forward to be used in video games. Looks like default models what you shouldn't use have forward defined to side. To achieve desired effect you should learn little of Blender and create your own asset with correctly defined directions.

Answers

  • GarromOrcShamanGarromOrcShaman Posts: 214Member
    edited April 2018 Accepted Answer

    It is not your fault nor bug. Look_at works just fine. Every 3D models must have defined where is up and where is forward to be used in video games. Looks like default models what you shouldn't use have forward defined to side. To achieve desired effect you should learn little of Blender and create your own asset with correctly defined directions.

  • MagicLordMagicLord Posts: 578Unconfirmed
    edited April 2018

    @hsn678 said:
    Hi,
    is it my fault or a bug?
    I expected A points to B
    see attached scene

    look_at has a bug, in my demo a model got scaled and offset using look_at.
    https://godotdevelopers.org/forum/discussion/19246/look-at-and-rotation

    I wish Godot gets simple rotation command like without needing extra parameters
    Quaternion.look_at(Vector3 direction)

    Another usefull function is
    Quaternion.look_at_lerp ( Vector3 direction, lerp_Value)

  • hsn678hsn678 Posts: 6Member
    edited April 2018

    @GarromOrcShaman said:
    It is not your fault nor bug. Look_at works just fine. Every 3D models must have defined where is up and where is forward to be used in video games. Looks like default models what you shouldn't use have forward defined to side. To achieve desired effect you should learn little of Blender and create your own asset with correctly defined directions.

    Thank you. I successfully exported .obj from Blender with 'up' and 'forward' properties. but .dae files and simple Godot's meshes doesn't seem support 'up' and 'forward' properties.
    Solved

  • GarromOrcShamanGarromOrcShaman Posts: 214Member

    @hsn678 said:

    @GarromOrcShaman said:
    It is not your fault nor bug. Look_at works just fine. Every 3D models must have defined where is up and where is forward to be used in video games. Looks like default models what you shouldn't use have forward defined to side. To achieve desired effect you should learn little of Blender and create your own asset with correctly defined directions.

    Thank you. I successfully exported .obj from Blender with 'up' and 'forward' properties. but .dae files and simple Godot's meshes doesn't seem support 'up' and 'forward' properties.
    Solved

    First thing, you should use "Better" Collada exporter.It was tweaked to work fine with GoDot. This "Better" exporter automatically set Blender's +Z as up and -Y as forward so you have some less work to do here. Glad to help :)

  • MagicLordMagicLord Posts: 578Unconfirmed

    @GarromOrcShaman said:
    It is not your fault nor bug. Look_at works just fine. Every 3D models must have defined where is up and where is forward to be used in video games. Looks like default models what you shouldn't use have forward defined to side. To achieve desired effect you should learn little of Blender and create your own asset with correctly defined directions.

    Every model has a forward vector and a up vector when they are dropped in the level.
    Why should we tell where is up and forward ?
    I wish we got a function like this : Quaternion.align( Vector3 direction)

  • GarromOrcShamanGarromOrcShaman Posts: 214Member

    @MagicLord said:

    Why should we tell where is up and forward ?

    Simply to know where is up and where is forward. Try download and use his test project. Forward is set to side what
    ended with incorrect rotation. I'm doing 3D graphics for video games for 3 years already, I know what i'm speaking about.

  • MagicLordMagicLord Posts: 578Unconfirmed

    @GarromOrcShaman said:

    @MagicLord said:

    Why should we tell where is up and forward ?

    Simply to know where is up and where is forward. Try download and use his test project. Forward is set to side what
    ended with incorrect rotation. I'm doing 3D graphics for video games for 3 years already, I know what i'm speaking about.

    I was only telling you some other 3D Engines have align function that needs only one vector3 parameter.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file