This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=172 as retrieved on 1 Aug 2007 20:40:15 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:_nIKTeCi-9gJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D172+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=80


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ rotate simple object

Posted by: bfi Nov 8 2006, 03:27 PM

Hello and congrats on the fine job you are doing with the engine!

I'm trying to rotate a simple object (a cylinder in this case) by pressing buttons. So far so good, rotX rotY works great, but as soon I change the rotation axis the object gets to its initial position. How can I fix this, or achive the same effect other way?

Thanks,
have a nice day!


Attached File(s)
Attached File  cilindru.fla ( 272k ) Number of downloads: 14

Posted by: kiroukou Nov 8 2006, 04:58 PM

Hi,
I'm sorry but I can't open a fla. Don't have flash at home.

Can you attach a swf? Or the interessting part of your code?

++

Posted by: Petit Nov 8 2006, 10:36 PM

QUOTE(bfi @ Nov 8 2006, 04:27 PM) *


I'm trying to rotate a simple object (a cylinder in this case) by pressing buttons. So far so good, rotX rotY works great, but as soon I change the rotation axis the object gets to its initial position. How can I fix this, or achive the same effect other way?


I have looked at your code, and I think you are doing this a little too complicated.
It is true that the rotX, rotY and rotZ functions are exclusive, that is a rotY call will cancel the result of earlier calls.

If you keep track on the rotation angles and add to them on each step, which you do, you could use the rot( xval, yval, 0) function instead. That way you are using all current rotation values every time.

Instead of using the onEnterFrame event, you should use the World3D onRenderEVENT, for example set

world.addEventListener (World3D.onRenderEVENT, this, rotate);

and in the rotate function check if a key is down
if (Key.isDown (Key.UP)){ x +=dx }

Then use rot( x, y, z )

See also my http://www.petitpub.com/labs/media/flash/sandy/transformations.shtml

Hope that helps!


Posted by: fjr Nov 9 2006, 01:09 AM

Whoa.. thats a good simple and clear tutorial you got there Petit! thanks!
Why not put them on Sandy's wiki site??!

Posted by: kiroukou Nov 9 2006, 07:16 AM

It's my fault ...
Petit has done them few weeks agon and they are really nice!
I'm going to add the tutorial right now !!

Posted by: Petit Nov 9 2006, 05:46 PM

Thanks guys wink.gif
It's work in progress and based on Sandy 1.1

Posted by: kiroukou Nov 9 2006, 08:30 PM

Just as information, the modification between the 1.1 and the future 1.2 are very small. Don't worry about the code port then wink.gif

Posted by: bfi Nov 10 2006, 07:08 AM

Ok, this is great, thank you very much! I am new to sandy, and I missed the rot() function biggrin.gif


Regards

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)