ok i used Mike's code for the 3rd person view, now i want the camera to snap to a certain position(the side of the objeect) when the mouse is clicked....this is sort of my battle mode, so everytime you left click to shoot, it goes there, then when you right click it goes back to the normal position
heres the code so far:
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
// the main entry point for the application is this function
float Max;
float XAngleCamera;
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
//Make world Objects
dbLoadObject("gign.x",1);
dbPositionObject(1,0,0,0);
dbMakeMatrix(2,75,75,75,75);
dbScaleObject(1,12,12,12);
dbRotateObject(1,180,180,0);
//Makes the camera rotation mount above the player
dbMakeObjectSphere(3,1);
dbPositionObject(3,dbObjectPositionX(1),dbObjectPositionY(1) + 2,dbObjectPositionZ(1));
dbScaleObject(3,.001,.001,.001);
//Camera Options
dbPositionCamera(dbObjectPositionX(3),dbObjectPositionY(3),dbObjectPositionZ(3));
dbSetCameraRange ( 1, 1000);
// our main loop
while ( LoopGDK ( ) )
{
//Camera Loop Options
//This Positions the camera so its always at the camera mount.
dbPositionCamera(dbObjectPositionX(3),dbObjectPositionY(3),dbObjectPositionZ(3));
//Positions The camera mount so its always above the player
dbPositionObject(3,dbObjectPositionX(1),dbObjectPositionY(1) + 2,dbObjectPositionZ(1));
//Makes float XAngleCamera always = the camera mount's X angle
XAngleCamera = dbObjectAngleX(3);
//Makes float Max = the camera mount's object X angle + or minus mouse up and down movement.
Max = dbObjectAngleX(3) + dbMouseMoveY() / 2;
//Rotates the camera mount's X angle to equal Max
dbXRotateObject(3,Max);
//Sets the camera's X and Z angle to the same as the camera mount and sets it's Y angle to the same as the player.
dbRotateCamera(dbObjectAngleX(3),dbObjectAngleY(1),dbObjectAngleZ(3));
//Rotates the player model left and right based on the mouse
dbRotateObject( 1, 0, dbObjectAngleY(1) + dbMouseMoveX() / 2, dbObjectAngleZ(1) ) ;
//Sets the camera to always be behind the camera mount
dbMoveCamera( -15 );
//Hide The Mouse and has the mouse always at the middle of the screen
dbPositionMouse (dbScreenWidth() /2, dbScreenHeight() /2);
dbHideMouse ();
//Player Controls
if (dbKeyState(17)) // W Move Forward
dbMoveObject (1,.25);
if (dbKeyState(30)) // A straffe left
dbMoveObjectLeft(1,.25);
if (dbKeyState(32)) // D straffe Right
dbMoveObjectRight(1,.25);
if (dbKeyState(31)) // S Move Back
dbMoveObject(1,-.25);
// update the screen
dbSync ( );
}
// return back to windows
return;
}