Hey Emiel,

I've discovered a few things when trying to move "the camera" in Source:

1)  I'm assuming you are treating the player as the camera.  We've
found it helpful to write a server side class to update the player
location there - which will update the client.  Otherwise, if you
force things on the client side, they don't necessarily update the
server.  I dropped in a code snippet below to do this.  Just add it as
a .cpp in the dll folder, compile, and start using the command to
update the server.

2)  Gravity and the ground are not your friend.  If you are trying to
move the player lower, and there is a surface there, the physics
engine will negate your changes.
Solutions:  Set noclipping on (noclip @ console) or move the ground
way low and turn off gravity

3)  SetAbsOrigin() sets the location of the player's feet.  The
player's eyes are 64 in above, assuming a standard player model.  So
when you move the player with setAbsOrigin
account for the fact you are actually moving the deet.  If you enable
position debuggin (cl_showpos 1 @ console) this shows the adjusted
position of the eyes.

Here is a tutorial of sorts that *may* be helpful.

http://digitalblacksmith.com/wiki/index.php/ValveSourceTransformations

Hope this helps. Steve

Code for updating player pos on server:

<code>

#include "cbase.h"
#include "convar.h"

void SetUserPosition( void ){
        CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
        if(pPlayer != NULL && (engine->Cmd_Argc() == 4)){
                //Msg("trying to set user pos..\n");
                float x = atof(engine->Cmd_Argv(1));// * 1.25f; // 1.25f is a 
small
adjustment for the lab size
                float y = atof(engine->Cmd_Argv(2));
                float z = atof(engine->Cmd_Argv(3));
                /*
                float offsetX = atof(engine->Cmd_Argv(4));
                float offsetY = atof(engine->Cmd_Argv(5));
                float offsetZ = atof(engine->Cmd_Argv(6));
                float offsetPitch = atof(engine->Cmd_Argv(7));
                float offsetRoll = atof(engine->Cmd_Argv(8));
                float offsetYaw = atof(engine->Cmd_Argv(9));
                */
                //if(z > 0) z = 0;
                
                
                Vector pos;
                
                //Translate player's feet to tracker
                pos = pPlayer->GetAbsOrigin();
                pos.x = x;
                pos.y = y;
                pos.z = z;
                pPlayer->SetAbsOrigin(pos);
                
                
        }
}

static ConCommand set_user_position( "set_user_position",
SetUserPosition, "Set the user's position from tracker x,y,z with
offset oX, oY, oZ, oPitch, oRoll, oYaw", 0 );
</code>

To call from client (put this in cl_dll/in_main.cpp):

<code>
char command[64];
sprintf(command, "set_user_position %f %f %f", x, y, z);
engine->ClientCmd(command);             
</code>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to