That's the Number3D syndrome :)) Last week lost hours on a vector.subtract(othervector);
Fabrice On Dec 4, 2010, at 7:12 PM, Michael Iv wrote: > Ha Ha ,shame on me,thanks a lot John ! What dumb mistake..Kind of irritating > stuff you could spend hours on I should defenitely take a break from coding > ... :) > > On Sat, Dec 4, 2010 at 8:07 PM, John Brookea out s <[email protected]> > wrote: > Crossproduct returns a vector3D > > trace(mouseVector.crossProduct(vector)) > trace(mouseVector) > > > > On 4 December 2010 16:34, Michael Iv <[email protected]> wrote: > Hi all. I have been working on converting some stuff to Away3.6/ > I was surprised to find that Flash player vector.crossProduct() returns quite > different result than number3D.cross(). > First of all I am sure that number3d.cross() is right because calculating > cross product manually I arrived to the same result.Here is example. > > Cross by number3d.cross: > var vector:Vector3D=new Vector3D(); > > var mouseVector:Vector3D=new Vector3D(400 - mouseX, mouseY - > 300, 0); > > vector.cross(new Vector3D(0,0,1),mouseVector) > > let's say mouseVector is 87,2,0 then the result is ----->2,-87,0 > also doing it manually based on 3d math operation: > > private function crossP(v1:Vector3D,v2:Vector3D):Vector3D{ > var crossVec:Vector3D=new Vector3D(); > crossVec.x=v1.y*v2.z-v1.z*v2.y; > crossVec.y=v1.z*v2.x-v1.x*v2.z; > crossVec.z=v1.x*v2.y-v1.y*v2.x; > return crossVec; > > } > rerturns the same result . > > Now check this out: > var vector:Vector3D=new Vector3D(0,0,1); > > var mouseVector:Vector3D=new Vector3D(400 - mouseX, mouseY - > 300, 0); > > mouseVector.crossProduct(vector); > > mouseVector is-->87,2,0 > > WTF???? > > > > -- > 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] > > > > > > -- > 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] >
