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.
-Bryan
David Grogono wrote:
> 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>
>
>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|