This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?showtopic=581 as retrieved on 10 Aug 2007 03:15:37 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:jXJi3QE3GisJ:www.flashsandy.org/forum/index.php%3Fshowtopic%3D581+site:www.flashsandy.org/forum&hl=en&ct=clnk&cd=4


Google is neither affiliated with the authors of this page nor responsible for its content.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Help!!! Rotating a Cube, Rotating a Cube down
boogie
post Jul 15 2007, 10:34 AM
Post #1


Newbie
*

Group: Members
Posts: 9
Joined: 12-July 07
Member No.: 1,319



Hi,

I'm trying to rotate a cube in two ways, first I rotate from rigth to left (no problem with that) but when I try to rotate from up to down I just can't get it right. I'm posting an example (test.zip) of what I want to do with Sandy (This example is not done with Sandy), and also I'm posting what I'm getting with sandy sandy_tes.swf.

To rotate the cube in sandy i'm using these two methods:


public function rotateRight(){
_iniHAng = _endHAng
_endHAng += 60
_rotint = new RotationInterpolator( _myEase.create(), 50 ,_iniHAng,_endHAng);
_rotint.setAxisOfRotation(new Vector(0,-1,0));
_cubo.setTransform( _rotint );
}


// THIS IS WHAT I'M NOT GETTING RIGHT

public function rotateDown(){
_iniVAng = _endVAng
_endVAng += 90
_rotint = new RotationInterpolator( _myEase.create(), 50 ,_iniVAng,_endVAng);
_rotint.setAxisOfRotation(new Vector(-1,0,0));
_cubo.setTransform( _rotint );
}


Any help will be apreciated, thanks (IMG:style_emoticons/default/biggrin.gif)


Attached File(s)
Attached File  test.zip ( 642.61k ) Number of downloads: 10
Attached File  sandy_test.swf ( 305.46k ) Number of downloads: 11
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Petit
post Jul 15 2007, 06:16 PM
Post #2


Advanced Member
***

Group: Moderator
Posts: 587
Joined: 21-June 06
From: Borgholm, Sweden
Member No.: 38



QUOTE(boogie @ Jul 15 2007, 10:34 AM) *

Hi,
I'm trying to rotate a cube in two ways, first I rotate from rigth to left (no problem with that) but when I try to rotate from up to down I just can't get it right. I

I'm not at all certain about this, but I think it may be because your'e using the same RotationInterpolator for both rotations. Maybe you should add your cube to a TransformGroup and set one RotationInterpolator to that, add it to another TransformGroup and let it have another RotationInterpolator, one for each direction.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
boogie
post Jul 17 2007, 08:48 AM
Post #3


Newbie
*

Group: Members
Posts: 9
Joined: 12-July 07
Member No.: 1,319



QUOTE(Petit @ Jul 15 2007, 08:16 PM) *

I'm not at all certain about this, but I think it may be because your'e using the same RotationInterpolator for both rotations. Maybe you should add your cube to a TransformGroup and set one RotationInterpolator to that, add it to another TransformGroup and let it have another RotationInterpolator, one for each direction.


Hi Petit,
You were right (as allways (IMG:style_emoticons/default/tongue.gif) ) I need to add one Transf. into the other transf.
Any way hereare the two moves (just in case any body is interested on it)

CODE
var trans1:Transform3D = new Transform3D();
var tg1:TransformGroup = new TransformGroup();
var trans2:Transform3D = new Transform3D();
var tg2:TransformGroup = new TransformGroup();
    
tg1.addChild( cube );
tg2.addChild( tg1 );
bg.addChild( tg2 );
.....

// first I rotate 60 degrees from left to right
function rotateLeft(){
    y+=60
    trans1.rotAxis(new Vector(0,-1,0),y); // this is the same as  ==>  trans1.rotY(y)
    tg1.setTransform(trans1);
    }


// then I start moving the cuber down by 15 degrees
function rotateDown(){
    x+=15
    trans2.rotAxis(new Vector(Math.sin(Math.PI/3),0,Math.sin(Math.PI/6)),x)  // vector(sin(60º),0,sin(30º))
    tg2.setTransform(trans2);
}
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
boogie
post Jul 17 2007, 09:28 AM
Post #4


Newbie
*

Group: Members
Posts: 9
Joined: 12-July 07
Member No.: 1,319



CODE
// then I start moving the cuber down by 15 degrees
function rotateDown(){
    x+=15
    trans2.rotAxis(new Vector(Math.sin([b]Math.PI/6[/b]),0,-Math.sin([b]Math.PI/3[/b])),x)  // vector(sin([b]30º[/b]),0,sin([b]60º[/b]))
    tg2.setTransform(trans2);
}
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Petit
post Jul 17 2007, 09:41 AM
Post #5


Advanced Member
***

Group: Moderator
Posts: 587
Joined: 21-June 06
From: Borgholm, Sweden
Member No.: 38



QUOTE(boogie @ Jul 17 2007, 08:48 AM) *

Hi Petit,
You were right (as allways (IMG:style_emoticons/default/tongue.gif) ) I need to add one Transf. into the other transf.

Happy you solved the problem.
Always is too often (IMG:style_emoticons/default/cool.gif)

[ Two things about the forum:
You *can* edit your own post ( I did that )
By enclosing code in code tags, you separate code from other text - you do that by selection the code and pressing the # button. ]

Cheers!
/Petit
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

- Lo-Fi Version Time is now: 10th August 2007 - 02:54 AM
phpMyVisites