Speaking of boiler templates [and btw, I'm not sure why nobody answers
me on this forum, are my messages getting through?]...
Does anyone have a good Flash CS3 or FLEX 3.0 Professional Starting
Point Template(s) such as:
1. Here is a Template for Away3D that can be used as a bare bones
starter for <this type of application>
2. And/or, here is a Template for Away3D that has various utility
functions within it, to assist in the development of <this type of
application, e.g. a cartesian orthogonal application with a background
and placement of Away3D builder environmental objects/buildings, and
characters rigged for animation and can be changed to non-orthogonal
view>
etc.
Thanks,
-r
On May 7, 2009, at 4:39 AM, ben wrote:
HI Rib,
here is the code snipet of my transformation,
but you answered the main question:
"if you
do not fire the transform setter (and simply modify the properties
within
it), then the euler angles will not update on the camera object. "
here is the main part of the transformation that tween any object
matrix then positions and 3D rotations:
//added on scene init:
cameraTarget=new Object3D ;
startQuaternion=null;
endQuaternion=null;
currentQuaternion=null;
//added to any object in the scene
thing.addOnMouseDown(onMouseClickOnObject);
function onMouseClickOnObject(e:MouseEvent3D):void {
if (e.target!=null) {
cameraTarget.transform=e.target.transform;
if (e.target is Plane) {
cameraTarget.moveUp(200);
cameraTarget.pitch(90);///because plane need a 90
rotationX to be
straight
}
if (e.target is Plane!=true) {
cameraTarget.moveForward(200);
cameraTarget.roll(90),cameraTarget.yaw(180);
}
createTween(cameraTarget);
}
}
function createTween(target:Object3D):void {
camera.slerp=0;///this is an extra propertie added to object3D, you
can also use the embed extra propertie
var tweenObject:Object={};
tweenObject.x=target.x;
tweenObject.y=target.y;
tweenObject.z=target.z;
//tweenObject.bezierThrough=[{x:0,y:0,z:0,slerp:.2}];
tweenObject.ease="easeOut.Elastic";
tweenObject.slerp=1;
tweenObject.onUpdate=camera_updateCallback;
startQuaternion=Quaternion.createFromMatrix(camera.transform);//this
is a method I added to the Quaternion class
endQuaternion=Quaternion.createFromMatrix(target.transform);
TweenMax.to(camera, 1, tweenObject);
}
function camera_updateCallback():void {
currentQuaternion=Quaternion.slerp
(startQuaternion,endQuaternion,camera.slerp);///this is another method
I added to the Quaternion class
camera.transform.copy3x3(Quaternion.quaternion2Matrix
(currentQuaternion));////quaternion2Matrix is one more method I added
to the Quaternion class
}
the method added to the quaternion class are here:
http://groups.google.com/group/away3d-dev/browse_thread/thread/4056d80422f13929/e7895f56f9befcdf?lnk=gst&q=vector+quaternion#e7895f56f9befcdf