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 15:44:41 -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>
Hi Bryan -

Here's some sample code that you can play with.  Put it in the open  
event of an RB3Dspace and make sure that the Rb3Dspace is square.   
Hopefully it serves as a starting point for what you are trying to do.

Best regards, David



   Dim tm as New Trimesh
   Dim mDisplay as Group3D

   //Make a trimesh that is a 10x10 square
   tm.VertexCount = 4
   tm.VertexPositions.SetXYZ(0, -5, -5, 0 )
   tm.VertexPositions.SetXYZ(1, 5, -5, 0 )
   tm.VertexPositions.SetXYZ(2, 5, 5, 0 )
   tm.VertexPositions.SetXYZ(3, -5, 5, 0 )
   tm.TriangleCount = 2
   tm.Triangles.SetABC(0, 0, 1, 2)
   tm.Triangles.SetABC(1, 2, 3, 0)
   tm.RenderBackFaces= True

   //Set the X position of the Trimesh
   tm.Position.X = -25
   //This means that the left edge of the Trimesh
   //is at -30  (-25 - (width of 10)/2 )

   //Set the camera in a position where it can see the Object
   Rb3DSpace1.Camera.Position.z = 100

   //The desire is to move the camera
   //slightly to align the left edge of
   //the square with the left edge of
   //the field of view

   //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

   Rb3DSpace1.Objects.Append tm
   Rb3DSpace1.Update





--
David Grogono
www.grogware.com



_______________________________________________
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>