I seem to have stumbled on something of a bug in Gladius or its rendering backend CubicVR.js. More likely, I am just doing something wrong.
Whatever the reason, I am seeing different things when I place a camera above my solar system simulation than I do when I place the camera above the Earth. In the former I see the expected retrograde motion. In the latter, I do not. This could a bug somewhere in the Gladius stack, but I think it more likely that I am doing something wrong.
So instead of using the same Gladius "camera" and placing it differently between page loads, I am going to try to use two different cameras and switch between the two. I know that CubicVR.js can handle this—it include a multi-camera simulation (source). The question is, can I do the same in Gladius?
I rename the original camera as "camera1". The remainder of the camera definition remains the same:
space.add( new engine.simulation.Entity( "camera1",
[
new engine.core.Transform( [0, 0, 0] ),
new cubicvr.Camera({
targeted: true,
fov: 75
}),
new cubicvr.Light()
]
));
(I don't believe that "fov" actually changes the field of view)This gives me my expected above-the-solar-system view (with "constellation" markers):
I place the second camera 5 units behind the Earth and 2 above it:
space.add( new engine.simulation.Entity( "camera2",
[
new engine.core.Transform( [-5, 0, -2], [3*Math.PI/2, 0, Math.PI/2]),
new cubicvr.Camera(),
new cubicvr.Light()
]
[],
space.findNamed( "earth" )
));
When I reload the page, something unexpected happens—the views from the two cameras are superimposed on each other:The second view is really too close to Earth to see anything (and "fov" has no effect), so I move waaaay back:
space.add( new engine.simulation.Entity( "camera2",
[
new engine.core.Transform( [-100, 0, -25], [3*Math.PI/2, 0, Math.PI/2]),
new cubicvr.Camera({fov: 10.0}),
],
['@transform', '@camera', '@light'],
space.findNamed( "earth" )
));
With that, I get a better view at the start of retrograde:And after:
Even here it is difficult to spot the retrograde motion in the second camera (the view at the bottom). Normally Mars moves right-to-left, but in the above two it moves from left-to-right. The right-to-left movement mostly takes place when Earth revolution pushes Mars to the edge of vision.
So it seems that I need to come up with a better way to view Mars' retrograde motion from Earth's point of view. Likely I will have to fix the camera to Mars rather than straight out into space. It would also be good to figure out how to disable one or the other camera.
Day #429
No comments:
Post a Comment