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