This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?showtopic=253 as retrieved on 10 Aug 2007 04:41:43 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:b1_Gh-UWBN4J:www.flashsandy.org/forum/index.php%3Fshowtopic%3D253+site:www.flashsandy.org/forum&hl=en&ct=clnk&cd=71


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
> odd sprite2D scaling on rotation
karlos
post Jan 5 2007, 02:04 AM
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)
Attached File  sprite_test.swf ( 28.78k ) Number of downloads: 24
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
kiroukou
post Jan 5 2007, 08:01 AM
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?

++
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
kiroukou
post Jan 6 2007, 01:21 AM
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,
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
karlos
post Jan 7 2007, 11:53 PM
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();
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Peter Wooley
post May 14 2007, 10:38 PM
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)
Attached File  Sprite2D_bug.swf ( 35.54k ) Number of downloads: 12
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Peter Wooley
post May 15 2007, 12:07 AM
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!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
zeusprod
post May 15 2007, 01:41 PM
Post #7


Advanced Member
***

Group: Members
Posts: 253
Joined: 14-February 07
Member No.: 801



QUOTE(karlos @ Jan 4 2007, 10:04 PM) *


Re attached swf to see what i am talking about.

Karlos


Nice carousel. Did upgrading to 1.2 solve your problem as well?

If you are willing to share the carousel source code, I'm sure others would be interested. (and if it fails in 1.2, we can try some tests)
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 - 04:20 AM
phpMyVisites