« Return to Thread: camera.orbit issue.

Re: camera.orbit issue.

by Hanpan :: Rate this Message:

Reply to Author | View in Thread

Ok, with a LOT of playing about I finally managed to solve this (kinda).

var rotX:Number = (_stage.stage.mouseX-(_stage.stage.stageWidth / 2))*(0.05)-90;
var rotY:Number = (_stage.stage.mouseY-(_stage.stage.stageHeight / 2))*(0.05)+90;
camera.orbit(rotY, rotX);

The important thing to note is that you need to add +/-90 (degrees) onto the rotation figures in order to get the camera to face the stage directly.


Hi,

Thanks very much for the reply.

For some reason, my example just pans the camera around and my planes don't rotate. Do I need to set the camera to lookAt a particular target? What are you camera settings?

Also, is this example using the Great White trunk or 1.5?

Thanks!

venanmusic wrote:
hello.
Actually i think the whitevoid should have a better camera movemente.
so, i did it.
here the planes "look" at he mouse, instead of turning their backs into mouse. lol
sorry my english sucks.

In the render function you should have something like this

addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void {

        var rotY: Number = (mouseY-(stage.stageHeight/2))/(stage.height/2)*(300);
        var rotX: Number = (mouseX-(stage.stageWidth/2))/(stage.width/2)*(-300);
        camera.x= camera.x+(rotX-camera.x)/5;
        camera.y= camera.y+(rotY-camera.y)/5;
       
        renderer.renderScene(scene, camera, viewport);
}

what are u doing? the 1st part of the script(2 lines) you are setting how much distance your planes would have, and where they should turn. try changing the 300 to some other value.
and finally the last 2 lines of code are move the camera, and setting a delay time or a tweener effect. change the value 5 for different speeds.

I think thats all.
u can see a experiment here with this script running:
www.andrevenancio.com/teste2/





Sceneshift wrote:
Hi,

I've just download the latest version of PV2.0 and there seems to be a lot of changes to cameras.

What I am trying to do is create a really simple camera orbit, exactly like this:
http://www.whitevoid.com/application.html

I have tried using camera.orbit and a variety of different mouseXY algorithyms but I can't seem to get anything that resembles that simple "wobble" effect. My planes, viewports are all setup basically so I know its something I am doing with the camera.

Any help appreciates!

 « Return to Thread: camera.orbit issue.