--
[ Picked text/plain from multipart/alternative ]
Sorry, it commented some of it, This should work now,:


Somewhere in player.cpp (or sdk_player.cpp, or hl2_player.cpp) you need to
add a class like this:

#define BOX_MODEL_NAME "models/props/box.mdl"  //replace with actual path to
your .mdl of the model

class CBox : public CPhysicsProp //Or just CBaseProp
{
public:
 DECLARE_CLASS( CBox, CPhysicsProp );

 typedef CPhysicsProp BaseClass;
 CBox();


 bool CreateVPhysics( void );
 void Spawn( void );
 virtual void Precache();
 DECLARE_DATADESC();
};

BEGIN_DATADESC( CBox )

END_DATADESC()

LINK_ENTITY_TO_CLASS( box, CBox );

bool CBox::CreateVPhysics()
{
 // Create the object in the physics system
 IPhysicsObject *pPhysicsObject = VPhysicsInitNormal( SOLID_BBOX, 0,false );


 // Make sure I get touch called for static geometry
 if ( pPhysicsObject )
 {

  int flags = pPhysicsObject->GetCallbackFlags();
  flags |= CALLBACK_GLOBAL_TOUCH_STATIC;

  pPhysicsObject->SetCallbackFlags(flags);

 }


 return true;
}

void CBox::Precache()
{
 SetModel( BOX_MODEL_NAME );
 BaseClass::Precache();
}

CBox::CBox()

{

}

//-----------------------------------------------------------------------------

// Purpose:

//-----------------------------------------------------------------------------

void CBox::Spawn( void )
{
Precache();
SetModelName( MAKE_STRING( BOX_MODEL_NAME ) );
CreateVPhysics();
}

///Then somehwere in either the player Spawn or Initial Spawn, add something
like

CBox *pBox = CREATE_ENTITY( CBox,"box" );

Vector origin = GetAbsOrigin(); //Get the players origin
origin.z += 50; //adjust accordingly, this makes it spawn above the player

pBox->SetAbsOrigin( origin );
pBox->SetAbsAngles( GetAbsAngles() );
pBox->Spawn();
--

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

Reply via email to