Afaik CreateEntityByName("prop_dynamic") or similar will create that
type of entity (And add it to the render graph after you set the model).

Try that.

Steve Henderson wrote:
Emeil,

A couple of things to try:

1)  Ensure your method is actually being called...add some Msg("Hello
World From Spawner"); lines..ensure you enable developer code on the
console to se these by typing developer 1

2)  I've always just extended the Spawn() method for the base class I
am using (ala the tutorial here:
http://developer.valvesoftware.com/wiki/Authoring_a_Model_Entity)
Are you calling CWeaponSpawner::CreateWeaponModel( void ) from a
higher classes' Spawn() method

3) Adding models as children, that don't exist in a map is tricky
(I've never done it actually).  You have to ensure that all rendered
entities are in the render graph of Valve -- adding them to hammer
explicitly accomplishes this...If you create/spawn and entity that
isn't in your map, there are some extra steps you will need to do to
register this added model..You can probably google around and find out
what these steps are..

4)  Ref 3 above, it may be easier to add this weapon model to the map,
then attach it to whatever the parent is.  So you would create a model
entity class for the simple model you want to put over the
weapon...Then attach it to the weapon.

5)  I wrote a player_slaved_model class that attaches any model (.mdl
file) to the player:

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

When you add this entity to a hammer map, you specify the mdl file,
and the offset in position and orientation from the player.

You might be able to use this code for the same effect with a weapon
-- essentially slaving a model to a weapon at some arbitrary
transform.    Should be as simple as replacing the lines refering to
CBaseEntity *pPlayer to something like CBaseEntity *pWeapon.  Then
check out the line where pPlayer is assigned -- EHANDLE hPlayer =
gEntList.FindEntityByClassname( NULL, "player" ); -- and instead
search for your weapon.

Hope this helps -- Good Luck!

Steve

On Mon, Mar 10, 2008 at 4:22 PM, Emiel Regis <[EMAIL PROTECTED]> wrote:

Hey,

 I'm trying to render a simple model over a weapon spawn. It doesn't needs
 any collissions or such, just being visible. I'm using this code, called
 on Spawn() of the weapon spawner :

 in header:

 CBaseAnimating  pWeaponModel;

 in cpp:

 //Weapon model display code goes here
 void CWeaponSpawner::CreateWeaponModel( void )
 {
        // Create the object in the physics system
        int nSolidFlags = GetSolidFlags() | FSOLID_NOT_SOLID |
 FSOLID_NOT_STANDABLE | FSOLID_TRIGGER;

     PrecacheModel( pWeaponPath );

        pWeaponModel.Spawn();
        pWeaponModel.SetModel( pWeaponPath );
        pWeaponModel.SetMoveType( MOVETYPE_NONE );
        pWeaponModel.SetSolid( SOLID_BBOX );

        pWeaponModel.VPhysicsInitStatic();
        pWeaponModel.AddSolidFlags( nSolidFlags );

        pWeaponModel.SetAbsOrigin( GetAbsOrigin() + Vector( 0, 5 , 0) );
     pWeaponModel.SetAbsAngles( GetAbsAngles() );
     pWeaponModel.FollowEntity( this, "weapon_bone" ); // attach to player
 model

        pWeaponModel.RemoveEffects( EF_NODRAW);
 }

 However, nothing is drawn. The CBaseAnimating entity is shown in the
 cl_showents.

 An ideas?

 Cheers,
 Emiel Regis

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




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





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

Reply via email to