I don't know if applicable here, but you could try to use
applyRotations();
it resets the mesh rotations to zero, but applys to the vertices...
since its a cube, should go lightspeed.
for the materials, if you save the bmd sources, pass a cube data
object to the cube class.
then you just need to copypixel new data into each sourcebmds...
copypixel is fast too.
Fabrice
On Dec 5, 2008, at 6:45 AM, Stuart Kemp wrote:
I have been working on this problem, trying to find less technical
ways of dealing with the issue, and I have stumbled across a
technique that works. What I do is this: every time the user begins
a rotation event, I build a new cube with the two relevant faces and
create a spin between them.
This works supprisingly well, with the main downside being that two
spins will disorient the user as the transition is always taken
based on the current face, assuming it is upright, but this is
easily fixed by extending my transition lookup table.
However, it doesn't take long for the anims frame rate to suffer. In
fact, its a matter of 5 - 6 spins. I am using
the .removeChild(cube); method on my Scene3D object, as the class
file doesn't seem to have any better options, and It does appear to
remove it, because there is no weird clipping when the newest cube
rotates. However I believe the cube still exists in the code and
isn't being remobed by garbage collections as Flash claims. I am
recycling the "cube" variable, which should remove the only other
pointer to the object.
Is there either a better way to cull the cube object, or to change
the face materials without having to generate a anew cube?
Cheers,
Stuart
On Thu, Dec 4, 2008 at 9:03 AM, Stuart Kemp <[EMAIL PROTECTED]> wrote:
Pete: Unfortunatly, the issue isn't occuring when the angles are at
0. Only when Y is at 90, and I try ato access z.
I'm not using a constant rotation, that was just a test to prove my
theory that the rotationZ attribute was rotationg about an incorrect
axis.
In my application it is important that the users can see each face
of the cube, so I will need to allow them to rotate to 180. I have
tried offsetting the rotation by 0.00001 on all axes, and
multiplying by 5.0001, but these haven't changed anything.
Makc: I'm afraid my knowledge of 3D Matrix rotations is fairly
basic. However, my understyanding is that they are used to find the
axes and angles to rotate by, and are ultimatly broken down into
rotation about axes to be applied to the object. I have already
managed to perform that task, and the issue appears to be with the
way Away3d's .rotation attributes deal with that.
If I've got the wrong idea could you explain it to me please? Or
even some sites that explain it would do. I have an A-level
understanding of mathermatics.
Thanks for your help guys, but I don't think the answers are here.
On Thu, Dec 4, 2008 at 6:29 AM, Peter Kapelyan <[EMAIL PROTECTED]>
wrote:
A small workaround I often suggest/have used was to make sure your
rotation never reaches 0 or 180..etc...
So instead of something like
rotationY*=5
try
rotationY*=5.00001
might help it never reach exactly 0.
Hope it helps you out
-Pete
On Wed, Dec 3, 2008 at 2:04 PM, solpyro <[EMAIL PROTECTED]> wrote:
I am having trouble spinning objects about the z axis when theey have
already been rotated.
In my code I am working with a cube which I can rotate horizontally or
vertically. I have the code working to select the correct axis for
rotation, however if I have rotated the cube about the Y-axis, so that
the Z and X axes have swapped places, rotating with cube.rotationZ
results in exaxtly the same effect as cube.rotationX, ie. rotating
around the 'depth' axis as the user sees it.
Below is the code for the rotations. targetX, targetY and targetZ are
defined numbers containing the rotations we are trying to achieve. It
is only possible for one if the three rotations to occur at any one
time ('spinning' controls this).
function onEnterFrame( e:Event ):void {
//rotate cube about x-axis
if (targetX != cube.rotationX) {
trace("rotationg about X");
cube.rotationX*=5;
cube.rotationX+=targetX;
cube.rotationX/=6;
//snap to position when close
if (cube.rotationX<(targetX
+accuracy)&&cube.rotationX>(targetX-
accuracy)) {
cube.rotationX = targetX;
spinning = false;
}
}
//rotate cube about y-axis
if (targetY != cube.rotationY) {
trace("rotationg about Y");
cube.rotationY*=5;
cube.rotationY+=targetY;
cube.rotationY/=6;
//snap to position when close
if (cube.rotationY<(targetY
+accuracy)&&cube.rotationY>(targetY-
accuracy)) {
cube.rotationY = targetY;
spinning = false;
}
}
//rotate cube about z-axis
if (targetZ != cube.rotationZ) {
trace("rotationg about Z");
cube.rotationZ*=5;
cube.rotationZ+=targetZ;
cube.rotationZ/=6;
//snap to position when close
if (cube.rotationZ<(targetZ
+accuracy)&&cube.rotationZ>(targetZ-
accuracy)) {
cube.rotationZ = targetZ;
spinning = false;
}
}
view.render();
}
In an effort to debug this, I have removed this code from my
enterFrmae event, and replaced it with a simple cube.rotationZ += 2;
This works fine when the cube hasn't been modified in any way, but if
i first apply a y-rotation of 90, the same issue described above
occurs.
--
___________________
Actionscript 3.0 Flash 3D Graphics Engine
HTTP://AWAY3D.COM