Posted by: Petit Aug 26 2006, 12:42 PM
Hi!
I have fiddled around quite a bit with the earlier version of Sandy, and got the transforms to work.
Now with the new and cleaner 1.1 version, I don't seem to get it.
I'm trying to rotate a single Plane3D, but it always shows the same horizontal plane.
I'm extending the Sandy class, using _root as the root MovieClip ( bg ).
Here is the createScene ( overloaded ) function:
CODE
function createScene( bg:Group){
var planeGroup: Group = new Group();
var plane1 = new Plane3D( 150, 150, 2, 'tri' );
planeGroup.addChild(plane1);
//Transformations
var t:Transform3D = new Transform3D();
t.rot( 0,0,-90 );
var tg:TransformGroup = new TransformGroup(t);
planeGroup.addChild(tg);
bg.addChild(planeGroup);
// The camera is working just fine;)
getCamera().setPosition(0,200,-600);
getCamera().lookAt(0,0,0);
World3D.getInstance().render();
}
I'm looking at the horizontal Plane3D from above the ground y=200, and towards the origin [0,0,0].
With
t.rot(0,0,-90) I expect to rotate the planeGroup by 90 degrees around
the z-axis, and so get a vertical plane. But nothing happens, for any
combinations of rotation values. The plane stays horizontal.
I'm sure I'm doing something wrong here, but what?
Posted by: kiroukou Aug 26 2006, 01:11 PM
CODE
function createScene( bg:Group){
var planeGroup: Group = new Group();
var plane1 = new Plane3D( 150, 150, 2, 'tri' );
//Transformations
var t:Transform3D = new Transform3D();
t.rot( 0,0,-90 );
var tg:TransformGroup = new TransformGroup(t);
planeGroup.addChild(tg);
//add the objet you want to transform as a child of the transformation you want to apply!
tg.addChild(plane1);
bg.addChild(planeGroup);
// The camera is working just fine;)
getCamera().setPosition(0,200,-600);
getCamera().lookAt(0,0,0);
// Don't use it here, the Sandy class calls it already World3D.getInstance().render();
}
Posted by: Petit Aug 26 2006, 10:59 PM
Thanks indeed for your swift reply.
I really should have known to read your excellent tutorials.
I just dumbly assumed that the tutorial was for the earlier version of Sandy (why?)
It's all working nicely for me now.