I was able to emulate Ken's problem using the basic cubes and an
OrthoLens. Here's my setup code:
public function PhysicsTest():void
{
//Initialize Away3D
view = new View3D();
//try to center the render area
view.x = 200;
view.y = 200;
view.camera = new Camera3D();
view.camera.lens = new OrthogonalLens();
view.camera.zoom = 128;
view.camera.x = 0;
view.camera.y = -6.5;
view.camera.z = -1000;
view.camera.rotationX = -2;
addChild(view);
///Init and startup code
init();
}
private function init():void
{
//Create cubes
cube1 = new Cube6(null,10,100,10,1,1,1,1);
cube2 = new Cube6(null,10,100,10,1,1,1,1);
cube3 = new Cube6(null,200,1,300,1,1,1,1);
cube1.x = 5;
cube1.z = -100;
cube2.x = cube1.x - 10;
cube3.z = 1000;
view.scene.addChild(cube1);
view.scene.addChild(cube2);
view.scene.addChild(cube3);
//Event Listeners
addEventListener(Event.ENTER_FRAME, update);
}
private function update(e:Event):void
{
view.render();
}
With the same error occurring.
I noticed that the t value is never getting set when the verts are
projected in Mesh.as, which is odd since it's a flash function. Anyway
I used the following site and calculated the t value manually for the
time being:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS509D19BB-239B-4489-B965-844DDA611AE7.html
and it seems to work. I apologize if this is not a good fix, it seemed
to work for my test case, but correct me if I'm wrong on anything or
it's not ideal. Here's the code I added to Mesh.as. Warning, very
hacked code I'm sure I can cut off calculations for speed:
//DO NOT CHANGE vertices getter!!!!!!!
if(camera.lens is OrthogonalLens)
{
if(vertices.length > 0)
{
_screenVertices.splice(0,_screenVertices.length);
for(var iter:uint = 0; iter <
vertices.length; iter+=3)
{
var
testPosition:Vector3D =
Utils3D.projectVector(_viewMatrix3D, new Vector3D( vertices[iter],
vertices[iter+1], vertices[iter+2], 1 ) );
_screenVertices.push(
testPosition.x );
_screenVertices.push(
testPosition.y );
_uvtData[iter+2] = 1/ (
camera.focus + testPosition.z);
}
}
}
else
Utils3D.projectVectors(_viewMatrix3D,
vertices, _screenVertices,
_uvtData);
On Jun 10, 2:48 pm, kensuguro <[email protected]> wrote:
> Bummer.. here are the files seperately:
>
> http://groups.google.com/group/away3d-dev/web/GraphicsTester.ashttp://groups.google.com/group/away3d-dev/web/islanddesert.daehttp://groups.google.com/group/away3d-dev/web/ISLANDdesert.jpghttp://groups.google.com/group/away3d-dev/web/ISLANDdesertwater.jpg
>
> On Jun 10, 1:17 pm, katopz <[email protected]> wrote:
>
> > and this why that file fail ;o
>
> >http://groups.google.com/group/is-something-broken/browse_thread/thre...
>
> > On 10 June 2010 23:37, katopz <[email protected]> wrote:
>
> > > Hey Ken
>
> > > google just throw
>
> > >> The page you navigated to does not exist.
>
> > > on me for that link for some reason, do you mind send that directly to my
> > > [email protected] plz?
>
> > > thx
>
> > > On 10 June 2010 22:22, kensuguro <[email protected]> wrote:
>
> > >> Here's a quick test and the dae file I'm having trouble with.
>
> > >>http://groups.google.com/group/away3d-dev/web/send.zip
>
> > >> Very straight forward setup, a camera3d with ortho lens with a slight
> > >> tilt.
> > >> -Ken
>
> > >> On Jun 9, 10:00 pm, katopz <[email protected]> wrote:
> > >> > Hey Ken
>
> > >> > please provide some code with some primitive to produce this issue,
> > >> > i'll
> > >> > take a look
>
> > >> > thx
>
> > >> > On 10 June 2010 04:26, kensuguro <[email protected]> wrote:
>
> > >> > > btw, this is in away3dlite.
>
> > >> > > Rotation on the ortho lens doesn't effect the _uvtData at all. The t
> > >> > > is always 1. Can anyone confirm that this is the way ortho cams work
> > >> > > in general, or is it a missing feature or something? When I manually
> > >> > > set the t value to something else, at least I can affect the depth
> > >> > > sorting...
>
> > >> > > it's basically this line in Mesh class:
> > >> > > Utils3D.projectVectors(_viewMatrix3D, vertices, _screenVertices,
> > >> > > _uvtData);
>
> > >> > > And whatever the resulting _viewMatrix3D is when using ortho lens,
> > >> > > will not give proper values for t.
> > >> > > -Ken
>
> > >> > > On Jun 9, 2:19 pm, kensuguro <[email protected]> wrote:
> > >> > > > thanks for the reply,
> > >> > > > just doubled checked distance, but it doesn't seem to have any
> > >> effect
> > >> > > > in this case.
>
> > >> > > > On Jun 9, 1:43 pm, Bob Warfield <[email protected]> wrote:
>
> > >> > > > > Kensuguro, take care how close your camera is to the objects. I
> > >> > > discovered
> > >> > > > > a lot of weird artifacts if my camera is too close. In
> > >> > > > > particular
> > >> if
> > >> > > > > objects visible in the foreground can get significantly behind
> > >> > > > > the
> > >> > > camera,
> > >> > > > > bad things happen. This is apparently a known problem.
>
> > >> > > > > If your application allows it, try moving the camera further away
> > >> while
> > >> > > > > increasing the zoom to keep the same relative proportions. It
> > >> > > > > may
> > >> > > help. It
> > >> > > > > did wonders for me.
>
> > >> > > > > Cheers,
>
> > >> > > > > BW
>
> > >> > > > > On Wed, Jun 9, 2010 at 9:04 AM, kensuguro <[email protected]>
> > >> > > wrote:
> > >> > > > > > I'm not familiar with the mathematical implications of an
> > >> orthogonal
> > >> > > > > > lens, but can it not be rotated? It seems like when I rotate
> > >> it, the
> > >> > > > > > z-order sorting gets all messed up.
>
> > >> > > > > >http://groups.google.com/group/away3d-dev/web/Picture%20307.png
>
> > >> > > > > > see how the water behind the rocks is in front of it.
>
> > >> > --
> > >> > Regards
> > >> > -----------------------------------------------------------
> > >> > katopz,http://sleepydesign.com
> > >> > Away3D and JigLibFlash Developer Team
>
> > > --
> > > Regards
> > > -----------------------------------------------------------
> > > katopz,http://sleepydesign.com
> > > Away3D and JigLibFlash Developer Team
>
> > --
> > Regards
> > -----------------------------------------------------------
> > katopz,http://sleepydesign.com
> > Away3D and JigLibFlash Developer Team