BabylonJS / BabylonToolkit

Home of the community maintained Unity & Unreal exporters for Babylon.js
173 stars 46 forks source link

Need new document for the new version !! #31

Closed tidus2020 closed 3 years ago

tidus2020 commented 3 years ago

Like setting with Unity2020 or Unity2021, there is no meshComponent anymore...

tidus2020 commented 3 years ago

And the "ready" will run after many "update", and i can't rotate the cube with code "this.transform.rotation.y += 0.01;", but i can move it by "this.transform.position.x += 0.01;"

MackeyK24 commented 3 years ago

First you got it... Unity Version 2020.1 or greater.

Second, there is no mesh component, light component or camera component in the new version. There is only a BABYLON.ScriptComponent

Third, rotation in gltf uses Quaternions ... In BabylonJS, if mesh.rotationQuaternion is NOT NULL then mesh.rotation is ignored. The toolkit by default uses rotationQuaternion ... So either use the To and From Eulers adding to Y... or use mesh.addRotation(0,0.01,0)

MackeyK24 commented 3 years ago

If you absolutely want to use node.rotation instead of node.rotationQuaternion then you must NULL rotationQuaternion after you update the rotation values. There is a Scene Manager helper function to make this easy.

BABYLON.SceneManager.ValidateTransformRotation(mesh)

or (for short)

SM.ValidateTransformRotation(mesh)

Then you can use node.rotation.y += 0.01

MackeyK24 commented 3 years ago

Check this out https://forum.babylonjs.com/t/require-extension-cvtools-babylon-mesh-is-not-available/17592/9

That should help get you started

tidus2020 commented 3 years ago

Thanks for that ! and only one question , the "ready" function will run after "update" function , i have to handle it by myself?

MackeyK24 commented 3 years ago

The execute when ready function fires after ALL nodes have been parsed and when the scene loader goes away. This is after the awake and after the start and probably several updates