Posted By: RealSerious3D
Force Camera to View? - 04/17/11 16:00
Currently I have, thanks to all that have helped me, code that enables me to rotate an entity via LMB click-drag. Here's the code I am using:
Now what I would like to do is add a means to click some buttons and go to a particular view of that model. In other words, I would like to have buttons that read:
- front
- back
- side
- top
- Bottom
So I would need five buttons and clicking on one would snap the model to that view.
I think this could be done in two ways:
Moving the actual model
In this, the code would instantly rotate the model to face the camera depending on which button was pressed.
Setting up 5 cameras/positions and moving to the appropriate view
In this, a click on a button would switch the view to a preset camera/position. I would set up five cameras (front, back, side, top and bottom) and clicking the back button, for example, would switch to that position.
Now, I have the base idea, but am lost about how to implement it. Does anyone have any pointers?
Thanks in advance.
<edit>
Doing it via the camera/position is preferred now that I think about it, though doing it both ways would teach me more.
Thanks again.
Code:
action rotate() { while(1) { if (mouse_left){ my.pan += mouse_force.x; my.tilt += mouse_force.y; } wait(1); } }
Now what I would like to do is add a means to click some buttons and go to a particular view of that model. In other words, I would like to have buttons that read:
- front
- back
- side
- top
- Bottom
So I would need five buttons and clicking on one would snap the model to that view.
I think this could be done in two ways:
Moving the actual model
In this, the code would instantly rotate the model to face the camera depending on which button was pressed.
Setting up 5 cameras/positions and moving to the appropriate view
In this, a click on a button would switch the view to a preset camera/position. I would set up five cameras (front, back, side, top and bottom) and clicking the back button, for example, would switch to that position.
Now, I have the base idea, but am lost about how to implement it. Does anyone have any pointers?
Thanks in advance.
<edit>
Doing it via the camera/position is preferred now that I think about it, though doing it both ways would teach me more.
Thanks again.