realbasic-nug
[Top] [All Lists]

Re: RB3D Camera.position based on Object3d.postion

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: RB3D Camera.position based on Object3d.postion
From: David Grogono <dave at grogware dot com>
Date: Thu, 31 Jan 2008 17:23:25 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <47A005E9 dot 1040701 at radicalbreeze dot com> <1D6A4AF1-AD19-475B-8078-EDE99C414F36 at inspiringapps dot com> <47A166F0 dot 5050707 at radicalbreeze dot com> <F14EB11A-1352-4C70-9AAF-DB522140B16D at inspiringapps dot com> <47A21347 dot 3060802 at radicalbreeze dot com> <47A22EEF dot 3090005 at radicalbreeze dot com> <B17AA4B8-039B-41B2-B962-E463D181BEFD at grogware dot com> <47A24905 dot 8050901 at radicalbreeze dot com>
On Jan 31, 2008, at 4:17 PM, Bryan Lund wrote:

> Thanks David, also very helpful.
>
> Since, the FieldOfView applies to whichever is smaller (the height or
> the width) of the RB3dSpace, how would we do a similar calculation for
> the longer side?
>
> At that point is it pretty much just a matter of calculating for the
> short side with the FieldOfView, then determining the Height to Width
> ratio to determine the actual location?  (Or is there a more proper  
> way
> of going about it?)
>
> Thanks again for the help guys.

Hi Bryan -

You should be able to do the calculations for the shorter value and  
then multiply by the aspect ratio of the rb3dspace.  For the sample  
code I gave you, try making the control 400 pixels wide and 200  
tall.  Then where this code was:


    //Default field of view is 50°, half that is 25
    //tangent of 25° is .4663, multiply by 100
    //which is dist from camera to get 46.63

    //46.63-30 = 16.63

    Rb3DSpace1.Camera.Position.x = 16.63

Multiply 46.63 * 2 (which is the aspect ratio) = 93.26
93.26-30 - 30 = 63.26, so change the last line to

    Rb3DSpace1.Camera.Position.x = 63.26

Best regards, David




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>