Hey Justin! It's good to know you've worked a solution out!
Cheers Cauê 2010/2/18 Justin Lawerance Mills <[email protected]> > Caue > > Thanks for the haXe port, I think for absolute and relative rotational > globe movement quaternion's although heavy are the way to go. I sent this > to the sandy list thanks for porting Ralph's code to haXe hope to find time > to try using it with my proxy display object approach. > > Cheers > > ;j > > Begin forwarded message: > > * > * > *Subject: **Re: [Sandy] arcball haxe?* > * > * > > Ralph > > Re: flash 3d engines arcBall very simple approach using Ralph's code. > > I started to think about how to port it to an engine, but then realized it > was far simpler to use a dummy DisplayObject3D and pass across the > quaternion to the 3d objects matrix, ideally routing the mouse events from > the 3D object, so some tweaks would be needed but setting the _alpha of the > BoxSprite is a quick way to test my initial test suggests... > > So the main code mod is to store the drag _quaternion so I changed this > class... > > public function dragTo(vector:Vector3D):void > { > var v:Vector3D = startVector.crossProduct(dragVector); > dragQuat.x = v.x; > dragQuat.y = v.y; > dragQuat.z = v.z; > dragQuat.w = startVector.dotProduct(dragVector); > QuaternionUtil.multiplyQuats(dragQuat, startQuat, newQuat); > _quaternion.x = -newQuat.x; > _quaternion.y = -newQuat.y; > _quaternion.z = newQuat.z; > _quaternion.w = newQuat.w; > transformComponents[1] = newQuat; > _displayObject.transform.matrix3D.recompose(transformComponents, > Orientation3D.QUATERNION); > } > > For some reason I had to negate x and y that might have been for the globe > I was using? > > Then I added a getter that you could call every frame..... > > public function get matrix3D():org.papervision3d.core.math.Matrix3D > { > return _quaternion.matrix; > } > > can be set as.... _sphere.transform = arcBall.matrix3D; > > But in Sandy it would probably be like > > public function get matrix3D():sandy.core.data.Matrix4 > { > return QuaternionMath.getRotationMatrix( _quaternion ); > } > > can be set as.... _sphere.matrix = arcBall.matrix3D; > > And in Away.... > > public function get matrix3D():away3d.core.math.Matrix3D > { > return Matrix3D.quaternion2matrix( _quaternion ); > } > > can be set as.... _sphere.transform = arcBall.matrix3D; > > Hope to try in haxe in the future as Caue ( Thanks :) ) has kindly > changed the syntax over on Ralph's code over on the away3d list, I am not > sure if you can use native quaternions on the Away3DLite engine but that > would be very interesting if you can. > > Hopefully this approach will prove useful to anyone trying to mix dragging > and geolocation onto a single globe. Now if anyone can suggest the best way > to implement tweening and some momentum - slurps and an array for average > speed come to mind... or maybe I can just tween but should not specify tween > engine. > > I have only tested the concept on papervision and for the other engines > please check I have read the docs properly, I do aim to try them but not at > mo. > > cheers > > ;j > > > > > On 15 Feb 2010, at 12:09, Ralph Hauwert wrote: > > Hey Justin, > > > The source is there to be used, so if you see a chance to port it, that > would be great. It's not much code in any case, that being said : it's not > meant for any engine, but could be easily ported to do so ? > > > Regards, > > Ralph. > > > On Feb 13, 2010, at 7:09 PM, Justin Lawerance Mills wrote: > > > Hi > > > Has arcball > > > http://www.unitzeroone.com/blog/2009/09/08/source-better-flash-10-3d-interaction-arcball/ > > been ported to haXe yet or should I give it a go, I presume it would be > engine agnostic? Wanted to look at using with haxe away3Dlite and sandy3D > with moving across some zupko pv3d geolocation code. > > > Cheers > > > ;j > > > _______________________________________________ > > Sandy mailing list > > [email protected] > > http://osflash.org/mailman/listinfo/sandy_osflash.org > > > > _______________________________________________ > > Sandy mailing list > > [email protected] > > http://osflash.org/mailman/listinfo/sandy_osflash.org > > > _______________________________________________ > Sandy mailing list > [email protected] > http://osflash.org/mailman/listinfo/sandy_osflash.org > > >
