Peter Oliver Geller
2011-01-15 03:09:51 UTC
Hi all,
i have a carousel which i can drag well with a script over a rotationMatrix,
but i want to do some easing animations, plane detection from one scene to
another one and iŽm not able to do it with the transformation matrix,
because every plane object and container object in the scene has no changed
value i can work with, maybe iŽm to stupid to handle that right :-)
That is the standard code i found to do a drag transformation on a 3D
display.
var currentMousePoint:Point = new
Point(carouselDisplay.viewport.containerSprite.mouseX,
carouselDisplay.viewport.containerSprite.mouseY);
var difference:Point = currentMousePoint.subtract(previousMousePoint);
var vector:Number3D = new Number3D(difference.x, difference.y, 0);
var rotationAxis:Number3D = Number3D.cross(vector, FORWARD);
rotationAxis.normalize();
var distance:Number = Point.distance(currentMousePoint, previousMousePoint);
var rotationMatrix:Matrix3D = Matrix3D.rotationMatrix(null, -rotationAxis.y,
null, distance/600);
planeContainer.transform.calculateMultiply3x3(rotationMatrix,
planeContainer.transform);
previousMousePoint = currentMousePoint;
Maybe some one of you can help me with the following questions, because iŽm
a totally newbie on papervision:
Is it possible to get out the difference of the calculated rotationY of the
planeContainer matrix without to transform it?
So that i can handle the difference on the mousex axis like this:
planeContainer.rotationY = diff or -= diff whatever.
Is it better to transform everything inside the container with the
transformationMatrix?
The main reason why i ask that is the hit detection of a plane inside my
carousel view.
I have also an timer event which rotates 8 planes inside that planeContainer
about the rotationY value of the container step by step and also some Mouse
Event Tweenings with tweenlite like this:
public function setPlaneToFocus(pPlane) : void
{
var plane = pPlane;
var radians = -180 - (plane.localRotationY);
TweenLite.to(planeContainer, .6,
{shortRotation:{rotationY:radians}, onUpdate:carouselDisplay.singleRender,
ease:Expo.easeOut});
}
But now i put another planeobject for a hit detection inside another
container, for example hitDetectionContainer and positioned that object with
the same values, like the planes in the planeContainer, to force a hit
everytime when one of my planes run into that hit plane, but it doesnŽt
work. I get always a hit on one of my eight planes but that doesnŽt change,
the single plane is always true and all others always false, although if i
rotate the plainContainer.rotationY and my planes went through the
hitdetection plane, at least visually.
How would you do normally a hitdetection of a fixed position when some
objects going through?
I thought itŽs right when you do it like that:
hitDetectionPlane.hitTestObject(planes[0])
Planes is an array with my positioned planes inside the planeContainer.
Maybe i donŽt found a solution because itŽs too late, but if someone has
some examples or resources for me that would be great.
Regards
Peter
i have a carousel which i can drag well with a script over a rotationMatrix,
but i want to do some easing animations, plane detection from one scene to
another one and iŽm not able to do it with the transformation matrix,
because every plane object and container object in the scene has no changed
value i can work with, maybe iŽm to stupid to handle that right :-)
That is the standard code i found to do a drag transformation on a 3D
display.
var currentMousePoint:Point = new
Point(carouselDisplay.viewport.containerSprite.mouseX,
carouselDisplay.viewport.containerSprite.mouseY);
var difference:Point = currentMousePoint.subtract(previousMousePoint);
var vector:Number3D = new Number3D(difference.x, difference.y, 0);
var rotationAxis:Number3D = Number3D.cross(vector, FORWARD);
rotationAxis.normalize();
var distance:Number = Point.distance(currentMousePoint, previousMousePoint);
var rotationMatrix:Matrix3D = Matrix3D.rotationMatrix(null, -rotationAxis.y,
null, distance/600);
planeContainer.transform.calculateMultiply3x3(rotationMatrix,
planeContainer.transform);
previousMousePoint = currentMousePoint;
Maybe some one of you can help me with the following questions, because iŽm
a totally newbie on papervision:
Is it possible to get out the difference of the calculated rotationY of the
planeContainer matrix without to transform it?
So that i can handle the difference on the mousex axis like this:
planeContainer.rotationY = diff or -= diff whatever.
Is it better to transform everything inside the container with the
transformationMatrix?
The main reason why i ask that is the hit detection of a plane inside my
carousel view.
I have also an timer event which rotates 8 planes inside that planeContainer
about the rotationY value of the container step by step and also some Mouse
Event Tweenings with tweenlite like this:
public function setPlaneToFocus(pPlane) : void
{
var plane = pPlane;
var radians = -180 - (plane.localRotationY);
TweenLite.to(planeContainer, .6,
{shortRotation:{rotationY:radians}, onUpdate:carouselDisplay.singleRender,
ease:Expo.easeOut});
}
But now i put another planeobject for a hit detection inside another
container, for example hitDetectionContainer and positioned that object with
the same values, like the planes in the planeContainer, to force a hit
everytime when one of my planes run into that hit plane, but it doesnŽt
work. I get always a hit on one of my eight planes but that doesnŽt change,
the single plane is always true and all others always false, although if i
rotate the plainContainer.rotationY and my planes went through the
hitdetection plane, at least visually.
How would you do normally a hitdetection of a fixed position when some
objects going through?
I thought itŽs right when you do it like that:
hitDetectionPlane.hitTestObject(planes[0])
Planes is an array with my positioned planes inside the planeContainer.
Maybe i donŽt found a solution because itŽs too late, but if someone has
some examples or resources for me that would be great.
Regards
Peter