Up tonight, I would like to get my Gladius avatar running around an island. As of last night, I have a green, island-like thing. Tonight I need a sea and a horizon.
The sea is easy enough. I put a larger blue plane underneath the small green plane:
That looks pretty decent:
space.add(new engine.Entity("sea", [ new engine.core.Transform([0,2.7,0], [Math.PI/2,0,0], [10,10,10]), new cubicvr.Model(resources.plane_mesh, resources.blue_material) ] )); space.add(new engine.Entity("island", [ new engine.core.Transform([0,2.6,0], [Math.PI/2,0,0]), new cubicvr.Model(resources.plane_mesh, resources.green_material) ] ));
If I rotate 45° around, the sea horizon is no longer quite flat:
I can probably live with that, but I would like to get a skybox (or more properly a skysphere) in place. CubicVR.js has its own, built-in implementation of SkyBox that might be ideal; however it is not yet support in Gladius. So let's see if I can do the next best thing.
The next best thing, in Three.js was to surround the entire scene with a sphere. To get that to work, I had to flip the faces so that the normal, the side pointing "out" was flipped to point to the center of the scene.
So I try doing the same in Gladius:
I know that my
skyMesh = resources.sky_mesh; skyMesh.flipFaces(); skyMesh.prepare(); space.add(new engine.Entity("skybox", [ new engine.core.Transform([0,0,0], [0,0,0], [44,44,44]), new cubicvr.Model(skyMesh, resources.sky_material) ] ));
flipFaces()because (a) I am not getting any errors and (b) I can call it from the debugger:
And yet nothing happens. My sphere is still facing out when small:
And becomes completely invisible when it outgrows the scene. Bummer.
Like I said earlier, I can live without a skybox. For now. Especially if the CubicVR.js SkyBox is eventually exposed. So I call it a night here. I hope to play with collision detection tomorrow. I still doubt that I have the best Three.js solution. Hopefully Gladius has something better for me.