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] > >
