Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Trouble with camera and charector

Author
Message
DannyE
15
Years of Service
User Offline
Joined: 10th May 2009
Location:
Posted: 15th May 2009 23:43
I have a person "walking" (his legs don't move) around on a terrein but when i turn the person ends up behind me. Anyone know how to fix this or a tutorial that goes over this. And please do a direct link not a "suggestion".
ABXG
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Canada
Posted: 16th May 2009 12:11 Edited at: 16th May 2009 15:15
I have attached the code for my "Character Controller" which rely's on functions from Sparky's Collisions and a few functions and variables defined elsewhere in my code, such as "frameSpeedMod" which is used for my implementation of timer based movement. Also attached is my game in its current state so that you can see how my code actually works.

** Global.h is a file included by every source code file in my project, it includes references to a few header files needed by all my source files as well as some variable and function definitions.

EDT: Just thought I should clarify in case anyone does download my game. You need to hit the "New Game" and than "Start Game" buttons. You use the WASD keys and the mouse to navigate, press the shift key to run and space to jump. Most of the items you see on the menu's don't actually do anything. All my models in the game world are place-holders.

CharacterControl.h


CharacterControl.cpp


------------------------------------
Currently 1500+ lines of code into an "over-the-shoulder" action RPG with combat based on rag-doll physics.
DannyE
15
Years of Service
User Offline
Joined: 10th May 2009
Location:
Posted: 17th May 2009 03:05
HI ABXG thanks for the code, but I am brand new to this and am in 7th grade so... Ya. This is my code so far...

#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadObject ( "Colonel-X.x", 100 );
dbDisableEscapeKey ( );
dbSetCameraRange ( 1.0f, 30000.0f );
dbLoadImage ( "texture.jpg", 1 );
dbLoadImage ( "detail.jpg", 2 );
dbSetupTerrain ( );
dbMakeObjectTerrain ( 1 );
dbSetTerrainHeightMap ( 1, "map.bmp" );
dbSetTerrainScale ( 1, 30.0f, 6.0f, 30.0f );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture ( 1, 1, 2 );
dbBuildTerrain ( 1 );
dbLoadObject ( "skybox2.x", 3 );
dbSetObjectLight ( 3, 0 );
dbScaleObject ( 3, 300000, 300000, 300000 );
dbPositionCamera ( 385, 23, 135 );
dbSetObjectTexture ( 3, 3, 1 );
dbTurnObjectLeft ( 100, 180 );
dbPositionObject ( 100, 385, 75, 150 );
dbScaleObject ( 100, 9, 10, 10 );
while ( LoopGDK ( ) )
{
if ( dbLeftKey ( ) )
dbTurnObjectLeft ( 100, 0.75f );
if ( dbRightKey ( ) )
dbTurnObjectRight ( 100, 0.75f );
if ( dbUpKey ( ) )
dbMoveObject ( 100, -0.4f );
if ( dbDownKey ( ) )
dbMoveObject ( 100, 0.4f );
if ( dbShiftKey ( ) )
if ( dbRightKey ( ) )
dbTurnObjectRight ( 100, 1.0f );
if ( dbLeftKey ( ) )
if ( dbShiftKey ( ) )
dbTurnObjectLeft ( 100, 1.0f );
if ( dbShiftKey ( ) )
if ( dbUpKey ( ) )
dbMoveObject ( 100, -1.0f );
if ( dbShiftKey ( ) )
if ( dbDownKey ( ) )
dbMoveObject ( 100, 1.0f );
if ( dbShiftKey ( ) )
dbControlCameraUsingArrowKeys ( 0, 1.0f, 1.0f );
dbControlCameraUsingArrowKeys ( 0, 0.4f, 0.75f );
float fHeight = dbObjectPositionY ( 100 );
float fObjectOne = dbGetTerrainGroundHeight ( 1, dbObjectPositionX ( 100 ), dbObjectPositionZ ( 100 ) );
float fCameraOne = dbObjectPositionZ ( 100 );
dbPositionCamera ( dbCameraPositionX ( ), fHeight + 4.0f, fCameraOne - 6.50f );
dbPositionObject ( 100, dbObjectPositionX ( 100 ), fObjectOne + 0.0f, dbObjectPositionZ ( 100 ) );
dbUpdateTerrain ( );
dbSync ( );
}
return;
}

Login to post a reply

Server time is: 2024-10-01 01:35:58
Your offset time is: 2024-10-01 01:35:58