How to importing mesh (ex .glb), are translate rotation and position at once

hello, i have questions by importing mesh (ex .glb)
It has quaternion by default so i trans Vector3 ( rotationQuaternion.toEulerAngles() )
it was effective As a result synchronize mesh rotation and camera rotation
than add to responsive move to clicking point (create box and position settings)

I have a problem with this part.
just the camera worked easily, (Vector3.lerp) position to position and any function no problem
but importing mesh is not work to position
i think Vector3.lerp force compete with rotation setting to rendering

I think these are the reasons for the error

here is my first PG

can you give me some advice on these
Please write a question using translation and basic grammar and tell me if there is something you do not understand.

The function testGlb.rotationQuaternion.toEulerAngles(); probably doesn’t work they way you expect it to work. (line 43 in your playground)

Calling this function will not convert the rotation of the object to euler angles, but will return a new Vector3 with the current quaternion in euler angles. You will need to set it yourself and nullify the quaternion in order for the object’s rotation to be set in euler.

Regarding the position - setting the position of the mesh does work (9the way you use it in line 37), but since you are using a physics engine, the y value changes - it falls down to the ground. I might have misunderstood what doesn’t work, so if you can explain the issue with the position again it would be great!


thanks for replying
Your advice seems to have a meaning do mesh’s has quaternion angle trans to euler angle to do line 44 instead of line 43 But what I can’t do is not solved.
i want know about (line 65 in my playground) it was click to ground then i thinking importing mesh go to click target by method but it was’t go and rollback the first position value

Are you trying to animate the mesh to go to a specific target point in N amount of time?

You should use animations for that - Animation | Babylon.js Documentation

Having said that - mesh pick does work. You are lerping on pointer pick (and on each frame) from the current position (which is updated on each frame) to the target. 10% change on each frame. But this will never get you to the target, because on each frame you are calculating the 10% again, between the current position and the final position, so the 10% keeps getting smaller and smaller, but will always be 10% of the distance.

1 Like

i know lerping is’t get to Perfect target position so i select to timer is Approximate moving time
but I don’t understand why The model returns to the first position.

line in 65 just work but it it like being stuck on the floor and finish … return position

Unlike model, camera is working

so i will changing the way is nav mash and solve this problem later

Hi! @RaananW was saying that
testGlb.rotationQuaternion.toEulerAngles(); is doing nothing, however this

const rotation = testGlb.rotationQuaternion.toEulerAngles();
testGlb.rotation = rotation

does. But neither I could figure out what is the issue here :slight_smile:


hello @roland
i agree with you too so testGlb.quternion angles trans euler angles
and it is track camera.rotation(callback is just one call but it is update tracking)
eventually i think model has to handle 3 calculations

  1. scene.gravity(ex cannonJsPlugin) = position.y -0.9
  2. model rotation = camera rotation
  3. Vector3.Lerp model position → target position
    compositive calculations is bring different result
    i hypothesize, go to position less than i think position but it is not even
    model position is first position rollback
    1 + 3 = is proper result
    but 1+2+3… what ever? bug by trans rotation? or bug by single thread? if not i did you think a wrong anything

I am sorry, but your English is terrible :sunglasses: so I’m not sure what you do you want to achieve. Maybe you can use Google Translator.

What I get is: you want to apply gravity to the plane, lerp the movement of the plane and lerp the camera so it follows the plane. Is this correct?

Let’s try to keep it positive on the forum if possible :slight_smile: Strong English skills are not a requirement to post here!

I like the idea of using Google Translate though. @11128 can you give that a try?

1 Like

I apologize, I didn’t mean it the wrong way! We are all friends here. Maybe I am to honest but I believe honesty leads to solutions much more quicker. Peace!

1 Like

Hey dude! I hope I didn’t offend you! I swear it was friendly “terrible”, however I am sorry, please don’t take it to your heart! We are different in feelings. However maybe you are just on vacation :smiley:
Whatever, please use a translator so I can understand your needs or it will be a good idea to post a video with an existing game where the plane behaves like you want yours.

1 Like

hello @roland
sorry for the late reply because I had to finish other urgent project
I know you didn’t mean to be offensive
rather thanks for the reply,so are @DarraghBurke i’m using using Google Translate
but it is Not perfect except for general grammar even though applied it
back to the point I checked my PG again. but it is A horribly different kind of error occurred
So, I’ll fix it again in the near future. after that I will be more precise about this.


Sounds good! :+1:

1 Like