|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
Camera "true" orbit questionHi again
![]() I am getting along nicely with my first real PV3D project thanks to all the help from the mailing list. I'm wondering how to make make the camera actually orbit an object - like a satellite. Before you all say "why not rotate the object?" allow me to explain. As some of you know I am talking about a sphere of spheres. I want the user to be able to click on a sub-sphere and have the camera fly around the main sphere to the target and turn to face the sub-sphere while also pointing always at the centre of the main sphere. This way the user can always see the entire sphere system. Understand? At the moment the camera takes the shortest route to the target and although the camera lookAt() is set to the centre of the main sphere the results are inconsistent and the camera does not truly face the centre. I guess the ultimate goal is for the user to feel as if they were in a space-ship flying round a planet and docking here and there! Any help is truly appreciated |
|
|
Re: Camera "true" orbit questionsphere of spheres ? im working in somethig similar...
http://www.nabble.com/position-object-from-bitmap-data-to18508298.html On Wed, Jul 23, 2008 at 8:30 PM, gordee <gordee@...> wrote:
-- http://www.elkraneo.com http://bannersdemierda.blogspot.com/ _______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
Re: Camera "true" orbit questionYeah that's nice indeed but not the same as what I am trying ... www.gordoneverett.co.uk/flash_tests/sphereSphere.html Click on a sphere for a wacky result ... Gordon Everett Date: Wed, 23 Jul 2008 20:35:44 +0200 From: elkraneo@... To: papervision3d@... Subject: Re: [Papervision3D] Camera "true" orbit question sphere of spheres ? im working in somethig similar...
http://www.nabble.com/position-object-from-bitmap-data-to18508298.html On Wed, Jul 23, 2008 at 8:30 PM, gordee <gordee@...> wrote:
-- http://www.elkraneo.com http://bannersdemierda.blogspot.com/ Get fish-slapping on Messenger! Play Now _______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
|
|
|
Re: Camera "true" orbit questionI had seen the light demo before, its sweet. Gordon Everett Date: Wed, 23 Jul 2008 15:16:46 -0400 From: xero.nu@... To: papervision3d@... Subject: Re: [Papervision3D] Camera "true" orbit question i was working on some simple demo's for
great white at carlo's request, one of them
was a pointlight3D demo where the light
object orbits a cube...
the source has changed a few times since
this demo, so the code will not compile as
is, but take a look at the orbit() function
private function orbit():void rot += theSpeed.value;{ rotRad = (rot-90) * (Math.PI/180);
thelight.z = (theRadius.value * Math.cos(rotRad) ) * -1; //orbit on x axis if(dirx.selected==true){
thelight.x = theRadius.value * Math.sin(rotRad) * -1; thelight.y = theY.value; //orbit on y axis } else {
thelight.y = theRadius.value * Math.sin(rotRad) * -1; thelight.x = theX.value; } } this could easly be adapeted to work w/ the
camera as opposed to a light object. just set
your camera type as target, and sent the camera's
actual target value to the object your orbiting.
i am planning on updating that demo for the
examples folder... but im working w/ andy's
new effects merger right now ;D sorry C4!
hope this helps!
____ ___
\ \/ /___________ ____ .\ // __ \_ __ \/ _ \ ./ \ ___/ | | \( <_> ) /___/\ \___ >__|---\____/ | \_/ \/ | | xero harrison | | xero.nu@... | | http://xero.nu | | http://fontvir.us | | http://0x000000.nu | | http://xero.owns.us | `---------------------' ---------- Forwarded message ---------- From: gordee <gordee@...> To: papervision3D@... Date: Wed, 23 Jul 2008 11:30:39 -0700 (PDT) Subject: [Papervision3D] Camera "true" orbit question Hi again :working: I am getting along nicely with my first real PV3D project thanks to all the help from the mailing list. I'm wondering how to make make the camera actually orbit an object - like a satellite. Before you all say "why not rotate the object?" allow me to explain. As some of you know I am talking about a sphere of spheres. I want the user to be able to click on a sub-sphere and have the camera fly around the main sphere to the target and turn to face the sub-sphere while also pointing always at the centre of the main sphere. This way the user can always see the entire sphere system. Understand? At the moment the camera takes the shortest route to the target and although the camera lookAt() is set to the centre of the main sphere the results are inconsistent and the camera does not truly face the centre. I guess the ultimate goal is for the user to feel as if they were in a space-ship flying round a planet and docking here and there! Any help is truly appreciated -- View this message in context: http://www.nabble.com/Camera-%22true%22-orbit-question-tp18617437p18617437.html Sent from the Papervision3D mailing list archive at Nabble.com. Win £3000 to spend on whatever you want at Uni! Click here to WIN! _______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
Re: Camera "true" orbit questionHi all,
Here's a hackish solution (see attachment: click any sphere): // fired when clicked on a child-sphere private function onObjectClick(event:InteractiveScene3DEvent):void { var do3d : DisplayObject3D = event.target as DisplayObject3D; // save the camera transform var prev :Matrix3D = Matrix3D.clone(camera.transform); // move the camera to the child-sphere's position camera.x = do3d.x; camera.y = do3d.y; camera.z = do3d.z; // make the camera lookat the 'dummy' sphere at (0, 0, 0) camera.lookAt(this.sphere); // we now have a 'target' transform: here's where the camera should end up // we create a target quaternion for SLERPing p = Quaternion.createFromMatrix(camera.transform); // restore the camera transform! camera.transform.copy(prev); // create the 'source' quaternion for SLERPing q = Quaternion.createFromMatrix(camera.transform); // used by SLERP _alpha = 0; } protected override function onRenderTick(event:Event=null):void { // got source and target Quaternions ? if(p && q && _alpha <= 1) { var x : Number = camera.x; var y : Number = camera.y; var z : Number = camera.z; // distance of camera to 0,0,0 var d : Number = Math.sqrt(x*x+y*y+z*z); // move the camera to 0,0,0 (for succesful rotation!) camera.moveForward(d); // SLERP! var t : Quaternion = Quaternion.slerp(q, p, _alpha); // set the camera transform from the slerped quat camera.transform.copy(t.matrix); // move camera back to original position camera.moveBackward(d); _alpha += 0.05; } super.onRenderTick(event); } hope this helps! Tim 2008/7/23 Gordon Everett <gordee@...>: > Thanks very much xero! > > I had seen the light demo before, its sweet. > > Gordon Everett > > > ________________________________ > Date: Wed, 23 Jul 2008 15:16:46 -0400 > From: xero.nu@... > To: papervision3d@... > Subject: Re: [Papervision3D] Camera "true" orbit question > > > i was working on some simple demo's for > great white at carlo's request, one of them > was a pointlight3D demo where the light > object orbits a cube... > > http://the.fontvir.us/b10g/?id=103 > > the source has changed a few times since > this demo, so the code will not compile as > is, but take a look at the orbit() function > > private function orbit():void > { > rot += theSpeed.value; > rotRad = (rot-90) * (Math.PI/180); > > thelight.z = (theRadius.value * Math.cos(rotRad) ) * -1; > //orbit on x axis > if(dirx.selected==true){ > thelight.x = theRadius.value * Math.sin(rotRad) * -1; > thelight.y = theY.value; > //orbit on y axis > } else { > thelight.y = theRadius.value * Math.sin(rotRad) * -1; > thelight.x = theX.value; > } > } > > > this could easly be adapeted to work w/ the > camera as opposed to a light object. just set > your camera type as target, and sent the camera's > actual target value to the object your orbiting. > > i am planning on updating that demo for the > examples folder... but im working w/ andy's > new effects merger right now ;D sorry C4! > > hope this helps! > > ____ ___ > \ \/ /___________ ____ > .\ // __ \_ __ \/ _ \ > ./ \ ___/ | | \( <_> ) > /___/\ \___ >__|---\____/ > | \_/ \/ | > | xero harrison | > | xero.nu@... | > | http://xero.nu | > | http://fontvir.us | > | http://0x000000.nu | > | http://xero.owns.us | > `---------------------' > > > ---------- Forwarded message ---------- > From: gordee <gordee@...> > To: papervision3D@... > Date: Wed, 23 Jul 2008 11:30:39 -0700 (PDT) > Subject: [Papervision3D] Camera "true" orbit question > > Hi again :working: > > I am getting along nicely with my first real PV3D project thanks to all the > help from the mailing list. > > I'm wondering how to make make the camera actually orbit an object - like a > satellite. Before you all say "why not rotate the object?" allow me to > explain. As some of you know I am talking about a sphere of spheres. I want > the user to be able to click on a sub-sphere and have the camera fly around > the main sphere to the target and turn to face the sub-sphere while also > pointing always at the centre of the main sphere. This way the user can > always see the entire sphere system. > > Understand? > > At the moment the camera takes the shortest route to the target and although > the camera lookAt() is set to the centre of the main sphere the results are > inconsistent and the camera does not truly face the centre. > > I guess the ultimate goal is for the user to feel as if they were in a > space-ship flying round a planet and docking here and there! > > Any help is truly appreciated > -- > View this message in context: > http://www.nabble.com/Camera-%22true%22-orbit-question-tp18617437p18617437.html > Sent from the Papervision3D mailing list archive at Nabble.com. > > > > ________________________________ > Win £3000 to spend on whatever you want at Uni! Click here to WIN! > _______________________________________________ > Papervision3D mailing list > Papervision3D@... > http://osflash.org/mailman/listinfo/papervision3d_osflash.org > > _______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
Re: Camera "true" orbit questionhey, that was good tim!
i have done this previously using spherical coordinates but there was always some strange behaviour around the poles i never quite figured out how to fix. using quaternions looks to be perfectly smooth. i've wrapped up ur code in a quick test file if anyone else wants to try out this approach. L. On Thu, Jul 24, 2008 at 6:16 AM, Tim Knip <tim.knip@...> wrote: Hi all, _______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
Re: Camera "true" orbit questionstill playing with the code and I have a question for anyone that can answer it...
from reading the forums and emails, everyone's saying that in the new Camera3D class, if you set the camera.target to a DisplayObject3D, it then becomes a "target" type camera. im doing that at the start in my setupScene() method, so just wondering why we still need to call camera.lookAt in the above example. camera.lookAt(this.sphere); it doesn't work if the line is removed. seems a little redundant... L. On Fri, Jul 25, 2008 at 3:04 PM, Lukasz Karluk <julapy@...> wrote:
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
Re: Camera "true" orbit questionHi L. Tim,s code works nicely but for me it eats more and more memory the longer it runs. Was it like this for you? Gordon Everett Date: Fri, 25 Jul 2008 15:04:06 +1000 From: julapy@... To: papervision3d@... Subject: Re: [Papervision3D] Camera "true" orbit question hey, that was good tim! i have done this previously using spherical coordinates but there was always some strange behaviour around the poles i never quite figured out how to fix. using quaternions looks to be perfectly smooth. i've wrapped up ur code in a quick test file if anyone else wants to try out this approach. L. On Thu, Jul 24, 2008 at 6:16 AM, Tim Knip <tim.knip@...> wrote: Hi all, |