Skip navigation
Help

Well, Go3D is official - We need base 3D classes that all engines can use

What turned out to be just something to finally scratch a strict typing itch i'd had with tweening has no become and full blown side project. Not only did Moses get me started, but Graeme Asher and John Lindquist fueled the fire as well. Graeme's been working on Tween3DCamera and John's been helping me add some other properties like scale/scaleX/scaleY/scaleZ to the property types as well as a small refactor.

If you've tried Go3D lately, you'll notice that I had put static property methods (yeah kinda weird name, but that's what they do ) in Go3D.as, but have now moved them to Value.as in the properties directory. It seemed to make alot more sense with what their function was, and Go3D.as has been deleted for now since it serves no purpose.

check out the project here:
http://code.google.com/p/goplayground/wiki/JohnGrden

svn:
http://goplayground.googlecode.com/svn/trunk/JohnGrden/GO3D

One thing I added just today was the ability to pass a tweenTarget for a 3D object. If you look at the code samples below, you can now just pass a target and it's position and rotation will be used to tween to. You can also use constants to just tween to position or just rotation. You can also pass custom properties for it to use with the target. The swf demo I've posted in the playground basically tells the Cylinder object to use the properties of the orange sphere.

PLAIN TEXT
Actionscript:

  1. protected function tweenAll(e:Event=null):void
  2. {
  3.     resettargetObject();
  4.     tween = new Tween3D(targetObject, [Value.tweenTarget(middleObject)], duration, Easing.easeOutElastic);
  5.     tween.start();
  6. }
  7.  
  8. protected function tweenXYZ(e:Event=null):void
  9. {
  10.     resettargetObject();
  11.     tween = new Tween3D(targetObject, [Value.tweenTarget(middleObject, Value.XYZ)], duration, Easing.easeOutElastic);
  12.     tween.start();
  13. }
  14.        
  15. protected function tweenCustom(e:Event=null):void
  16. {
  17.     resettargetObject();
  18.     tween = new Tween3D(targetObject, [Value.tweenTarget(middleObject, [Value.X, Value.Y])], duration, Easing.easeOutElastic);
  19.     tween.start();
  20. }
  21.  
  22. protected function tweenRandom(e:Event=null):void
  23. {
  24.     tween = new Tween3D(targetObject, [Value.x(getRandom()), Value.y(getRandom()*.5), Value.z(getRandom())], duration, Easing.easeOutElastic);
  25.     tween.start();
  26. }

Value.tweenTarget() returns an array of Go3DProperty objects that Tween3D expects to get to do the tween. It's basically a convenient, yet strictly typed way of doing things. I'd say we're having as much fun as untyped objects at this point - Even more probably ;)

Note:
I'll be teaching on Go3D at the Toronto class in 2 weeks, and if you haven't signed up yet, I seriously suggest getting out there asap - seats are filling up

Now, the reason I say we need base 3D classes for all 3D engines to use is because in a situation where I want to open this up for Sandy3D or Away3D or any other 3D engine that uses x/y/z/rotationX/Y/Z/scaleX/Y/Z, I'd have to write specific classes tailored to their api and object types.

We need to have one set of common 3D classes that define the atom level of a 3D object with the main 10 properties:

x, y, z, rotationX/Y/Z, scale, scaleX/Y/Z

So, I'm going to be starting such an effort and see how that pans out ;) It makes too much sense especially when you consider any project that has to work with a 3D engine, but isn't integrated with the code base. ASCollada being one, and Go3D being another.

I'd love to hear people's thoughts on this matter.