- Home /
Looking for a 3D object viewer
I'm look to create a 3D object viewer that can be used during the game for players to inspect objects they pickup. So for instance, a player comes in contact with a fancy new sword. On that collision I want to bring up this 3D viewer so the player and zoom in on a new instance of the sword, do some free rotation of the object to look at all sides, etc.
I've implemented similar functionality in other engines but was wondering if something like this already exists in Unity, since I'm kind of a newbie with this engine.
I'm thinking left mouse drag will free rotate the object, right mouse drag up/down to zoom in/out. Maybe a few buttons to keep or discard the item. The object in the viewer would be dynamic, depending on the game object they come in contact with. It would likely be an imported mesh and texture.
I think I could take 2 approaches
Somehow render an instance of the object on a GUI, that can provide scroll bar support for when the object is zoomed in far enough that the top/bottom/sides are clipped off the screen.
Render an instance of the object right in from of the camera and create draggable 2D textures that simulate scrollbars where I just translate the object to adjust it's position in front of the camera.
If something like this is available or sort of works I will have something to start with, otherwise I'll have to build from scratch.
Thanks Tray
Answer by Molix · Apr 09, 2010 at 04:16 AM
I've implemented something like this using a second camera and a RenderTexture, i.e.
- spawn your sword and put it on a special layer that your main camera does not render
- point a second camera at your sword that only renders the layer your sword is on
- set the camera to render out to a RenderTexture (Pro only?)
- draw the rendered texture on your GUI
- use your GUI controls to manipulate the position of the second camera