Hi everyone,
I'm trying to use the ElevationReader method getLevel to position a
sphere on a generated terrain.
My terrain is defined like that:
_extrude = new SkinExtrude(points, {material:mat, recenter:true,
closepath:false, coverall:true, subdivision:1, bothsides:true,
flip:false});
_extrude.rotationX = 90;
_extrude.x = 0
_extrude.z = 500;
_extrude.y = 0;
(_extrude as Mesh).pushback = true;
Then my sphere:
var matsphere:ColorMaterial = new ColorMaterial( 0x2222AA );
_sphere = new Sphere ( {material:matsphere, segmentsH:15, segmentsW:
15, radius:50} );
_sphere.pushfront = true;
_sphere.x = 0;
_sphere.y = elevationreader.getLevel( 0, -500 );
_sphere.z = 500;
_view.scene.addChild(_sphere);
but the sphere is not position on the ground. it's flying up in the
air.
So in getLevel you're supposed to put the x and y value, but I used
the x and z values because the y value is the one I'm after. I used -z
( -500 ) because i've seen it like that in a tutorial but i'm not sure
if i should use 500 instead.
Also I suppose i should use an offset value but I have no idea how to
calculate it. I've seen something about it in a post but I didn't
understand it.
Can anyone see what's wrong? Can you explain how to find the offset
value? I think it's based on the height of the terrain but still not
confident about how to get the exact value.
Thanks!