|
| karlos |
Post
#1
|
|
Newbie Group: Members Posts: 7 Joined: 21-June 06 Member No.: 34 |
Hi,
I was wondering if any one had noticed a uneven scaling when you are rotating sprites. I have created a simple sprite test with 10 sprite2D objects plotted in the zx plane as a ring around 0,0,0. Using the mouse you can rotate left, right, up and down, if you let it spin for ~150 degrees the sprites start to distort and then pop most likley facing the other way (- scale). I am a little confused as the normal behaviour is to face the camera. So if anyone has seen this before and has a suggestion as to the cause, my confusion would be removed and i will be happy again. Re attached swf to see what i am talking about. Thanks Karlos Attached File(s) |
| kiroukou |
Post
#2
|
|
Administrator Group: Root Admin Posts: 910 Joined: 12-June 06 Member No.: 1 |
Hi,
which version of Sandy are you using? 1.2 BETA right? ++ |
| kiroukou |
Post
#3
|
|
Administrator Group: Root Admin Posts: 910 Joined: 12-June 06 Member No.: 1 |
Hi,
Indeed this problem is strange. Can you provide your test code, I'll do some tests with it and try to get what is wrong (IMG:style_emoticons/default/wink.gif) Cheers, |
| karlos |
Post
#4
|
|
Newbie Group: Members Posts: 7 Joined: 21-June 06 Member No.: 34 |
Hi
I am using Sandy 1.1 and the flash IDE the code is below. I am still unsure here but haven't had a chance to go digging yet. Thanks again Karlos CODE import sandy.core.data.*; import sandy.core.group.*; import sandy.primitive.*; import sandy.view.*; import sandy.core.*; import sandy.skin.*; import sandy.util.*; import sandy.core.transform.*; import sandy.events.*; import sandy.math.VectorMath; // flash 8 import flash.display.BitmapData; var rotation:Transform3D; var yrot:Number = 0; var cam_pos; var cam:Camera3D; var bg:Group = new Group(); var tg1:TransformGroup = new TransformGroup(); var rad_deg = 180/Math.PI; var deg_rad = Math.PI/180; var stg:Number = Stage.width/2; var stgH:Number = Stage.height/2; var angle:Number = 0; function init(Void):Void { var ecran:ClipScreen = new ClipScreen(this.createEmptyMovieClip('ecran', 10), 600, 600); cam = new Camera3D(700, ecran); World3D.getInstance().addCamera(cam); cam.moveHorizontally(-300); cam_pos = cam.getPosition(); World3D.getInstance().setRootGroup(bg); createScene(bg); World3D.getInstance().addEventListener(World3D.onRenderEVENT, this, rotate); World3D.getInstance().render(); } function createScene(bg:Group):Void { tg1 = new TransformGroup(); var skin:MovieSkin = new MovieSkin(dot, false); for (var i:Number = 0; i<=10; i++) { var sprite:Object3D = new Sprite2D(1); sprite.setSkin(skin); tg2 = new TransformGroup(); var translation:Transform3D = new Transform3D(); var ag:Number = 36*i; var tx:Number = Math.cos(ag*deg_rad)*100; var tz:Number = Math.sin(ag*deg_rad)*100; translation.translate(tx, 0, tz); tg2.setTransform(translation); tg2.addChild(sprite); tg1.addChild(tg2); } rotation = new Transform3D(); rotation.rot(0, 0, 0); tg1.setTransform(rotation); bg.addChild(tg1); } function cam_mv(angle) { camy = 0+Math.sin(angle*deg_rad)*cam_pos.z; camx = 0; camz = 0+Math.cos(angle*deg_rad)*cam_pos.z; cam.setPosition(camx, camy, camz); cam.lookAt(0, 0, 0); } function rotate() { var mv:Number = Math.round((((_xmouse-stg)/stg)*2.5)); if (yrot+mv<0) { yrot = 360+mv; } else { yrot += mv; } yrot = yrot%360; ang.text = "angle: "+yrot; angle = ((_ymouse-stgH)/stgH)*-60; cam_mv(angle); rotation.rot(0, yrot, 0); } init(); |
| Peter Wooley |
Post
#5
|
|
Newbie Group: Members Posts: 2 Joined: 11-May 07 Member No.: 1,148 |
I've also run into this issue, where the Sprite2d appears to be rotating in a way it should not be.
I see it has been a few months since this was discussed, and am wondering if any resolution was made, possibly in 1.2? I'm still using 1.1, but would be happy to make the conversion if this has been resolved. I've also attached a .swf of the bizarre behavior, perhaps not as eloquently as Karlos, but the odd part is that the view is more often than not, incorrect. You can just click and spin the center cylinder to see the white circle Sprite2D buggin' out. Thanks! This post has been edited by Peter Wooley: May 14 2007, 10:38 PM Attached File(s) |
| Peter Wooley |
Post
#6
|
|
Newbie Group: Members Posts: 2 Joined: 11-May 07 Member No.: 1,148 |
I
suppose answering my own question is silly, but I decided to port to
1.2 (from 1.1) and voila! the sprites work just as intended! Glad it
works!
|
| zeusprod |
Post
#7
|
|
Advanced Member Group: Members Posts: 253 Joined: 14-February 07 Member No.: 801 |
|
| Lo-Fi Version | Time is now: 10th August 2007 - 04:20 AM |