Authoring a Brush Entity/Code
miss shop au kingdom come get it on lyrics volcano eruptions in the last 10 years wine buys ortho online upenn 2009 movie bookings japanese manufactories steel the last rock show eviction forms free online library science programs lgbt latino signs of alzheimers marine radio licence online bible school of the south pacific microsoft pptp server ethnic sensitive internet explorer 7.0 natural logarithm expansion erotic lesbian sex stories arabic numerals in europe europe national anthem nicaragua missions 1 k scandinavia yahoo fr mail investigated people doing crazy things ip router linksys purchase stock directly window treatment baltimore download audiovox ringtones audiovox ringtone trailer park boy quote removing moles automotive diamond film window auto body part michigan qt kde windows supe bowl 39 modern day explorers pillow talk is extra estimate electric bill jay shawn singer reseau contact elle et lui nam network news white book 2.0 reaction vessels television cable advertising cost warcraft ii patch steel structures inc 1832 online james roberts one 2 many justice home apache mysql php windows installer 1 blonde legally rising junior las vegas land for sale mp3 to car adapter 1 game heat piston amount injury personal settlement sun tech student loans new home in las vegas nevada the texas state flag price singapore stock amc movie theater times awareness site myspace.com ethical aspects of information technology world war ii memorial washington d.c. michigan properties rental vacation stereo bluetooth headsets real estate agent license texas rectum pic web photo album templates someone told me lyrics marine trades association of new jersey klein high school texas yahoo page ranking massachusetts school closings tuesday applets chat java system affirmative action and university of michigan tintin images s african pop music job quant urban management consultants paul pratt library junk email e-mail mail chris auto mag upgrade 8 inch round cake pan violent crime rate by state research technology management magazine sildenafil airline flight paths cheap nexium new york tourist residental schools playroom flooring nail gun nail is my domain name available to register roosevelts new deals japanese lesbian gallery
//===== Copyright ÃÂÃÂÃÂé 1996-2005, Valve Corporation, All rights reserved. ======== // // Purpose: Simple brush entity that moves when touched // //============================================================================= #include "cbase.h" class CMyBrushEntity : public CBaseToggle { public: DECLARE_CLASS( CMyBrushEntity, CBaseToggle ); DECLARE_DATADESC(); void Spawn( void ); bool CreateVPhysics( void ); void BrushTouch( CBaseEntity *pOther ); }; LINK_ENTITY_TO_CLASS( my_brush_entity, CMyBrushEntity ); // Start of our data description for the class BEGIN_DATADESC( CMyBrushEntity ) // Declare this function as being a touch function DEFINE_ENTITYFUNC( BrushTouch ), END_DATADESC() //----------------------------------------------------------------------------- // Purpose: Sets up the entity's initial state //----------------------------------------------------------------------------- void CMyBrushEntity::Spawn( void ) { // We want to capture touches from other entities SetTouch( &CMyBrushEntity::BrushTouch ); // We should collide with physics SetSolid( SOLID_VPHYSICS ); // We push things out of our way SetMoveType( MOVETYPE_PUSH ); // Use our brushmodel SetModel( STRING( GetModelName() ) ); // Create our physics hull information CreateVPhysics(); } //----------------------------------------------------------------------------- // Purpose: Setup our physics information so we collide properly //----------------------------------------------------------------------------- bool CMyBrushEntity::CreateVPhysics( void ) { // For collisions with physics objects VPhysicsInitShadow( false, false ); return true; } //----------------------------------------------------------------------------- // Purpose: Move away from an entity that touched us // Input : *pOther - the entity we touched //----------------------------------------------------------------------------- void CMyBrushEntity::BrushTouch( CBaseEntity *pOther ) { // Get the collision information const trace_t &tr = GetTouchTrace(); // We want to move away from the impact point along our surface Vector vecPushDir = tr.plane.normal; vecPushDir.Negate(); vecPushDir.z = 0.0f; // Move slowly in that direction LinearMove( GetAbsOrigin() + ( vecPushDir * 64.0f ), 32.0f ); }