- A Camera to view the duck, see below
- With a transform matrix, again see below
- It is a basic method of loading the Scene object, but not the only way. Our samples use it and it can be used in your own projects. The quick answer is it probably should be, but has not been included historically.
If you are doing the process manually using the SceneLoader, Camera and Default Rendering:
- Once you have done sceneLoader.load then you need to make sure you are updating the camera using updateProjectionMatrix() and updateViewProjectionMatrix.
- To set the position of the duck you need to do:
var duckNode = scene.findNode("LOD3sp");
duckNode.setLocalTransform(duckMatrix);
where duckMatrix is the matrix for duckNode. Created like so:var duckMatrix = mathDevice.m43BuildIdentity();
var v3Position = mathDevice.v3Build(x, y, z);
mathDevice.m43SetPos(duckMatrix, v3Position);
An example of this can be found in the Camera sample and Load Model samples (Camera sets the position post load and Load Model sets it before load)
If you just want to get the duck loading, then using Protolib is a simpler library to do it:
duckMesh = protolib.loadMesh({
mesh: 'models/duck.dae',
v3Size: mathDevice.v3Build(1.0, 1.0, 1.0),
v3Position: mathDevice.v3Build(x, y, z)
});
To render the duck set the camera position and camera direction with protolib.setCameraPosition & protolib.setCameraDirection between protolib.beginFrame() and protolib.endFrame()
An example of this can be found in apps/protolibsampleapp/scripts/protolibsampleapp.js
Does this make sense? Let me know if you need more detail.