Adding the Object3D to the scene appears to have no effect, neither does using a Mesh instead. So I guess the core question is this:
Should any two Away3D objects, when placed at the same x,y, and z coordinate and told to lookAt() an object's position have the same rotationX,rotationY, and rotationZ values? Assuming the pivot point is the same as well? I should mention that the planes in question are arranged in a circle around scene point 0,0,0. I suspect this is a bug, because why else would it not work? I have not messed with the yUp setting either. On Jan 28, 2:01 pm, simplychaos <[email protected]> wrote: > Thanks, but It's not that it goes around the long way, it just arrives > at a completely incorrect rotation. Skewed way off to the side and at > an angle. I've accounting for it going around the long way when I > animate back to it's original position, because I've got that working > already. So I think the problem is obtaining the actual coordinates to > rotate to. > > I take back what I said about the getting the rotation angle with a > dummy Object3D working correctly without the tween. The root of the > problem is that setting an Object3D that is not added to the scene > (maybe it would work if added to the scene?) to the coordinates of the > plane, then telling it to lookAt the camera and setting rotation of > the actual plane gradually toward those values does not work. So > somehow even though it's in the same locating and told to lookAt the > same position, it arrives at a different rotation than the plane > itself? I even checked pivotPoint or whatever and both plane and dummy > object are set to 0,0,0. I will try adding the Object3D to the scene > and see if it makes any difference. > > On Jan 28, 1:50 pm, Peter Kapelyan <[email protected]> wrote: > > > I had to do somethign similiar a week ago and I couldn't tween that > > number...and I had the exact effects you had that one of them would go > > around the long way..... > > > The only thing I could get workign was something like this function, that > > I've used alot: > > > function properRotation(target_rotation,my_rotation,smooth) { > > var rot =target_rotation-my_rotation; > > while (rot<0) { > > rot += 360; > > } > > while (rot>180) { > > rot -= 360; > > } > > my_rotation += rot/smooth; > > return my_rotation; > > > } > > > Hope it helps or someone has a better work around. > > > -Pete > > > On Wed, Jan 28, 2009 at 4:44 PM, simplychaos <[email protected]> wrote: > > > > Ok this question is a little complicated, but hopefully someone can > > > make some sense of it. I have 5 planes arranged in a circle, all > > > facing outward from the center point they are based around. The idea > > > is to let the user rotate around them, which works fine. I have it set > > > up so you can click on a given plane and it will rotate around to it. > > > So the problem comes when I want the selected plane to smoothly rotate > > > toward the camera as the camera is rotating around toward the plane. I > > > have created a "dummy" Object3D, set it's x,y,z to the same as the > > > plane, and told it to lookAt(camera.position), then I adjust pitch so > > > it is facing correctly (which I tested with the actual plane before). > > > So I should have calculated the exact rotation that I want to tween to > > > for that frame, right? I use TweenMax to tween to that frame, and for > > > 1 out of the 5 planes it works perfectly. Camera is set to lookAt > > > plane, and plane is tweening to lookAt camera, and they match up > > > perfectly every time. The other four all tween toward different weird > > > angles though... If I get rid of the tween and just set the plane to > > > lookAt camera, getting the rotation the same way with Object3D, it > > > works fine, but obviously just snaps to look at the camera instantly. > > > So I don't think there is any problem with my code, since it's > > > obviously getting the correct rotation variables. Any suggestions? > > > -- > > ___________________ > > > Actionscript 3.0 Flash 3D Graphics Engine > > > HTTP://AWAY3D.COM
