Model Viewer Scripting -- Please Help!

Hey everyone. I know next to nothing about coding so any help you guys could give me would be great.

I’m trying to create a model viewer to display my 3d models on my website. I would like it to function similar to the Batman: Arkham Asylum model viewer such as:

a) Click and drag anywhere on the screen with the left mouse button to spin the model around the y axis. Preferably allowing it to slow down to a stop after you release your mouse rather then a sudden stop.

b) Camera Zoom with the mouse wheel, with restrictions on both max and min distance to the object

c) Camera pan up and down while holding right click and moving the mouse up and down, again with restrictions on both max and min height of the camera

d) If possible, have it spin slowly on it’s own if nothing is done to it.

Again, thanks for any help you guys can give me!

Its not that hard to do. Just check out the third person cams, and the wow camera topics ot get most of those features. Then its as easy as putting your models in an array. I’m sure no one will just hand you the end product without some pay or trade. That can be set up in the collaboration section of the forum. Just a warning though there has been some recent topics about pirates being able to steal anything viewed in a web based application. So take any security measures you may need to.

Should be fairly easy to do. First you’ll have to take a look at the Unity - Manual: Input. There are those GetAxis functions, that you can use to get how much you have dragged your mouse. You can then use this value in the Transform class, there’s a function, called Rotate, which will rotate your model based on what value you have given to it (in this case, the value from the GetAxis).
http://unity3d.com/support/documentation/ScriptReference/Transform.Rotate.html

Camera zoom should be really easy. Just attatch a script to your camera, checking if the mousewheel has been scrolled and than add some value to the current transform.position of the camera (check the Unity - Scripting API: Transform class) I assume you just want the camera to get closer and further from the model, not zoom like…zoom :smile:

Panning would be done in pretty much the same way as zooming, just with other coordinates and smaller values that you will add to your transform.position.

Slow rotation would be done with Transform.Rotate again, but instead of using a value from Input.GetAxis(), this time it would be constant value.