SpriteSheetAnimator with Sprite3d????

Software: Away3D 4.x

fermmm, Newbie
Posted: 17 June 2013 01:21 AM   Total Posts: 7

I’m trying to use the SpriteSheetAnimator class with a Sprite3D, the only thing that is stopping me is the animator property of Sprite3D class that is “read-only”. Is that some kind of bug? How can I make an animated Sprite3D? I don’t want to code a sprite sheet class from scratch

   

Avatar
Siroko, Newbie
Posted: 23 August 2013 12:15 AM   Total Posts: 6   [ # 1 ]

Same here.. I don’t know if you can extend a Plane and remove the rotation matrix math into the vertex shader of the geometry..

   

Mario M., Newbie
Posted: 23 August 2013 12:47 PM   Total Posts: 12   [ # 2 ]

I’m using planes instead of Sprite3D for animated textures.
The auto-orientation is easy to implement, updating on every frame:

case SPRITE_AIR:
 
//Air
 
mesh.lookAt(camera.positionVector3D.Y_AXIS);
 
mesh.yaw(180);
 break;
case 
SPRITE_GROUND:
 
//Ground
 
mesh.rotationY = - (Helper.getAngle(mesh.scenePosition.xmesh.scenePosition.zcamera.xcamera.z) * 180 Math.PI) - 90;
 break; 

Maybe you will need different angle corrections, but it’s only paying with numbers.
Helper.getAngle gets the angle between 2 2D points, I think it can be done with other Vector clases, but I didn’t find it.

public static function getAngle (x1:Numbery1:Numberx2:Numbery2:Number):Number
{
 
var dx:Number x2 x1;
 var 
dy:Number y2 y1;
 return 
Math.atan2(dy,dx);
   

Avatar
Siroko, Newbie
Posted: 25 August 2013 02:05 AM   Total Posts: 6   [ # 3 ]

Yes, I have been some issues using planes and refreshing the rotation because my camera has been quantized to 100 steps for the 360 degrees. But finally was my mistake, using Math.round instead of Math.ceil in one operation smile

My approach to the rotation was quite simple :

plane.rotationX camera.rotationX 270;
plane.rotationY camera.rotationY;
plane.rotationZ camera.rotationZ

It works OK but I would try your approach on Monday smile

Thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X