Authoring a Brush Entity/Code
small garage designs internet services in bangalore intellectual property in internet 44 pacemaker xanax active x not working 40 old russian woman year 20 generator myspace picture address email personal search azithromycin post office jacksonville north carolina attorney in denver co motorcycle rider training course xanax missile threat sport polos portugese man owar symantec system center console download institute of directors manchester joy jameson tivo faqs mississippi paint horse club linda moore kid snow ac cars homepage edisons lab locale job centres in birmingham uk animal online game surplus hunting gear quake 2 server setup takes you i hope it takes me too lyrics pimp your myspace page sims in the city cheats for ds religious myspace graphics manufacture toy mono ringtones pioneer home cinema systems 15 pic pregnancy week alprazolam online air jordan nike retros space marines conversions inexpensive new york hotels taylor building crystal city virginia voice ringtones scariest haunted house in the world robert frosts writing style non pierced body jewellery louis and clark time line thailand tot job quant free samsung ringtones zyban online 3 episode pic star war rise of nations expansion review nationwide play off tickets oregon salem travel murphy bed with book case tax return problem servername publicservice commission isolation le man self divorce texas microsoft anti virus free downloads whistling lyrics rtsp info.net lebanon virginia newspapers table top centerpiece travis band website real black wife used bassinet retrieve information male bdsm loan pharmacy student saudi family visa rabbit posters authentication form sql win rock star fashion textcolor html maui condos rent rival record pc tv cards amanda bynes pictures wow factory map of evanston il paris official tourist site cheap adipex those were the days today in history licensed nursing online typing exercise high school unitary representation tips for enter the matrix tree of life christian schools ohio secure file delete ebony anal movie english grammar sentence nick knight photography website york shire dog cheap prozac quick and easy soups
//===== 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 ); }