I am not a math guru, but if you can use flash player 10, here are
some procs that may help:

private function getSceneSpaceMatrix(localMatrix:Matrix3D,
orderedParentMatrixList:Array):Matrix3D
{
        var sceneSpaceMatrix:Matrix3D = new Matrix3D();
        sceneSpaceMatrix.append(localMatrix);
        for each(var parentMatrix:Matrix3D in orderedParentMatrixList)
sceneSpaceMatrix.append(parentMatrix);
        return sceneSpaceMatrix;
}
private function getLocalSpaceMatrix(sceneSpaceMatrix:Matrix3D,
orderedParentMatrixList:Array):Matrix3D
{
        var tempMatrix:Matrix3D = new Matrix3D();
        for each(var parentMatrix:Matrix3D in orderedParentMatrixList)
tempMatrix.append(parentMatrix);
        tempMatrix.invert();
        var localSpaceMatrix:Matrix3D = sceneSpaceMatrix.clone();
        localSpaceMatrix.append(tempMatrix);
        return localSpaceMatrix;
}

*****And I would use them like this:
1. Put your tracker in position on the plane (no offset yet) using
your method.
2. Then:
var orderedParentMatrixList:Array = new Array();
orderedParentMatrixList[0] = floor.transform.matrix3D;
//orderedParentMatrixList[1] = floor.parent.transform.matrix3D; //
Only use this if floor is child of something else
orderedParentMatrixList[2] = view.scene.transform.matrix3D;
var trackerMatrixInFloorSpace:Matrix3D =
getLocalSpaceMatrix(tracker.transform.matrix3D,
orderedParentMatrixList);
trackerMatrixInFloorSpace.appendTranslation(0, yourYOffset, 0);
tracker.transform.matrix3D =
getLocalSpaceMatrix(trackerMatrixInFloorSpace,
orderedParentMatrixList);

I have not tested the above code in #2, so it may be buggy. But I
think the idea is sound. Also, I am using lite so I am not sure if
regular away3D has this kind of access to the 3d matrices. Hopefully I
am not leading you on a wild goose chase...

-Shawn


On Jul 29, 3:28 am, Michael Iv <[email protected]> wrote:
> Is this portable to Away3D ? (will try it out anyway) :))
>
>
>
> On Thu, Jul 29, 2010 at 1:09 PM, katopz <[email protected]> wrote:
> > i think you miss plane normal or unproject?
>
> > try
> >http://away3d.googlecode.com/svn/branches/lite/bin/ExPlane3D.swf
>
> > src
>
> >http://away3d.googlecode.com/svn/branches/lite/src/interactives/ExPla...
>
> > libs
> >http://away3d.googlecode.com/svn/branches/lite
>
> > hth
>
> > On 29 July 2010 16:14, Michael Iv <[email protected]> wrote:
>
> >> This question for math gurus among us :)
>
> >> Actually it seems to be straightforward but I still can't get it work.
> >> I have got a plane (floor) which is elevated 35 degrees at X axis. i
> >> have   small plane (tracker) that I need to move on top of the floor plane
> >> using Mouse3D x,y,z coordinates.
> >> The problem . Because the tracker is assigned the coordinates of the floor
> >> it actually intersects with it.I need to offset it let's say 100 px on 
> >> local
> >> Y. If the floor was not sloped it would be piece of cake ( just to change
> >> its Y). But here it appears to be more tricky.Already tried to scale ,add,
> >> subtract the position vector as well as retrieve the normal vector from
> >> underneath face andto transform it to global coords. Nothing gets it
> >> right.The only close solution I have found by now is to add to the tracker
> >> position  a vector with some Y component offset.But it gives uneven Y of 
> >> the
> >> tracker while moving it around the floor.
> >> I am sure I miss some basic  calculation here.
> >> Some one has an idea how to solve it ?
>
> >> Thanks a lot !
>
> >> --
> >> Michael Ivanov ,Programmer
> >> Neurotech Solutions Ltd.
> >> Flex|Air |3D|Unity|
> >>www.neurotechresearch.com
> >>http://blog.alladvanced.net
> >>http://www.meetup.com/GO3D-Games-Opensource-3D/
> >> Tel:054-4962254
> >> [email protected]
> >> [email protected]
>
> > --
> > Regards
> > -----------------------------------------------------------
> > Todsaporn Banjerdkit, katopz,http://sleepydesign.com
> > Away3DLite and JigLibFlash Developer Team
>
> --
> Michael Ivanov ,Programmer
> Neurotech Solutions Ltd.
> Flex|Air 
> |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://www.meetup.com/GO3D-Games-Opensource-3D/
> Tel:054-4962254
> [email protected]
> [email protected]

Reply via email to