예제 #1
0
Hit3DPoly::Hit3DPoly(Vertex3Ds * const rgv, const int count) : m_rgv(rgv),m_cvertex(count)
{
	normal.x = 0.f;
	normal.y = 0.f;
	normal.z = 0.f;

    // Newell's method for normal computation
	for (int i=0; i<m_cvertex; ++i)
	{
		const int m = (i < m_cvertex-1) ? (i+1) : 0;

		normal.x += (m_rgv[i].y - m_rgv[m].y) * (m_rgv[i].z + m_rgv[m].z);
		normal.y += (m_rgv[i].z - m_rgv[m].z) * (m_rgv[i].x + m_rgv[m].x);
		normal.z += (m_rgv[i].x - m_rgv[m].x) * (m_rgv[i].y + m_rgv[m].y);		
	}

	const float sqr_len = normal.x * normal.x + normal.y * normal.y + normal.z * normal.z;
	const float inv_len = (sqr_len > 0.0f) ? -1.0f/sqrtf(sqr_len) : 0.0f;   // NOTE: normal is flipped! Thus we need vertices in CCW order
	normal.x *= inv_len;
	normal.y *= inv_len;
	normal.z *= inv_len;

	m_elasticity = 0.3f;
    SetFriction(0.3f);
	m_scatter = 0;
}
예제 #2
0
RigidBody::RigidBody(Rect rect)
{
	float width = (rect.right - rect.left);
	float height = (rect.bottom - rect.top);

	// Create a Rectangle shape - origin middle
	mShape = new Shape();
	mShape->setOrigin(Vector(rect.left + width/2, rect.top + height/2, 0));
	mShape->addPoint(Vector(-width/2, -height/2, 0));	// top - left
	mShape->addPoint(Vector(-width/2, height/2, 0));	// bottom - left
	mShape->addPoint(Vector(width/2, height/2, 0));   // bottom - right
	mShape->addPoint(Vector(width/2, -height/2, 0));	// top - right

	setStatic(false);
	mAlive = true;
	mTexture = NULL;

	SetMass(1);
	SetVelocity(0, 0);
	SetAngularVelocity(0.0f);
	SetForce(Vector(0, 0, 0));
	SetTorque(Vector(0, 0, 0));
	SetMomentum(Vector(0, 0, 0));
	SetFriction(1.0f);
	SetSleeping(false);
}
예제 #3
0
/*
================
idPhysics_RigidBody::idPhysics_RigidBody
================
*/
idPhysics_RigidBody::idPhysics_RigidBody( void ) {
	// set default rigid body properties
	SetClipMask( MASK_SOLID );
	SetBouncyness( 0.6f );
	SetFriction( 0.6f, 0.6f, 0.0f );
	clipModel = NULL;
	memset( &current, 0, sizeof( current ) );
	current.atRest = -1;
	current.lastTimeStep = USERCMD_MSEC;
	current.i.position.Zero();
	current.i.orientation.Identity();
	current.i.linearMomentum.Zero();
	current.i.angularMomentum.Zero();
	saved = current;
	mass = 1.0f;
	inverseMass = 1.0f;
	centerOfMass.Zero();
	inertiaTensor.Identity();
	inverseInertiaTensor.Identity();
	// use the least expensive euler integrator
	integrator = new idODE_Euler( sizeof( rigidBodyIState_t ) / sizeof( float ), RigidBodyDerivatives, this );
	dropToFloor = false;
	noImpact = false;
	noContact = false;
	hasMaster = false;
	isOrientated = false;
#ifdef RB_TIMINGS
	lastTimerReset = 0;
#endif
}
예제 #4
0
void CGrenadeMP5::Spawn( void )
{
	Precache( );
	SetSolid( SOLID_BBOX );
	SetMoveType( MOVETYPE_FLY );
	AddFlag( FL_GRENADE );

	SetModel( "models/grenade.mdl" );
	//UTIL_SetSize(this, Vector(-3, -3, -3), Vector(3, 3, 3));
	UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));

	SetUse( &CBaseGrenade::DetonateUse );
	SetTouch( &CGrenadeMP5::GrenadeMP5Touch );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_plr_dmg_mp5_grenade.GetFloat();
	m_DmgRadius		= sk_mp5_grenade_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_bIsLive		= true;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( 400 ) );	// use a lower gravity for grenades to make them easier to see
	SetFriction( 0.8 );

	SetSequence( 0 );

	m_fSpawnTime	= gpGlobals->curtime;
}
void CGrenadePathfollower::Spawn( void )
{
	Precache( );

	// -------------------------
	// Inert when first spawned
	// -------------------------
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_SOLID );

	SetMoveType( MOVETYPE_NONE );
	AddFlag( FL_OBJECT );	// So can be shot down
	AddEffects( EF_NODRAW );

	UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));

	m_flDamage		= sk_dmg_pathfollower_grenade.GetFloat();
	m_DmgRadius		= sk_pathfollower_grenade_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 200;

	SetGravity( 0.00001 );
	SetFriction( 0.8 );
	SetSequence( 1 );
}
예제 #6
0
	void CPlantedC4::Init( CCSPlayer *pevOwner, Vector vecStart, QAngle vecAngles )
	{
		SetMoveType( MOVETYPE_NONE );
		SetSolid( SOLID_NONE );

		SetModel( PLANTED_C4_MODEL );	// Change this to c4 model

		SetCollisionBounds( Vector( 0, 0, 0 ), Vector( 8, 8, 8 ) );
		

		SetAbsOrigin( vecStart );
		SetAbsAngles( vecAngles );
		SetOwnerEntity( pevOwner );
		
		// Detonate in "time" seconds
		SetThink( &CPlantedC4::C4Think );

		SetNextThink( gpGlobals->curtime + 0.1f );
		
		m_flTimerLength = mp_c4timer.GetInt();

		m_flC4Blow = gpGlobals->curtime + m_flTimerLength;
		m_flNextDefuse = 0;

		m_bStartDefuse = false;
		m_bBombTicking = true;
		SetFriction( 0.9 );

		m_flDefuseLength = 0.0f;
		
		SpawnControlPanels();
	}
예제 #7
0
void CBasePlayer::SharedSpawn()
{
	SetMoveType( MOVETYPE_WALK );
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_STANDABLE );
	SetFriction( 1.0f );

	pl.deadflag	= false;
	m_lifeState	= LIFE_ALIVE;
	m_iHealth = 100;
	m_takedamage		= DAMAGE_YES;

	m_Local.m_bDrawViewmodel = true;
	m_Local.m_flStepSize = sv_stepsize.GetFloat();
	m_Local.m_bAllowAutoMovement = true;

	m_nRenderFX = kRenderFxNone;
	m_flNextAttack	= gpGlobals->curtime;
	m_flMaxspeed		= 0.0f;

	MDLCACHE_CRITICAL_SECTION();
	SetSequence( SelectWeightedSequence( ACT_IDLE ) );

	if ( GetFlags() & FL_DUCKING ) 
		SetCollisionBounds( VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX );
	else
		SetCollisionBounds( VEC_HULL_MIN, VEC_HULL_MAX );

	// dont let uninitialized value here hurt the player
	m_Local.m_flFallVelocity = 0;

	SetBloodColor( BLOOD_COLOR_RED );
}
예제 #8
0
//
// Throw a chunk
//
void CGib::Spawn( const char *szGibModel )
{
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetFriction(0.55); // deading the bounce a bit
	
	// sometimes an entity inherits the edict from a former piece of glass,
	// and will spawn using the same render FX or m_nRenderMode! bad!
	SetRenderAlpha( 255 );
	m_nRenderMode = kRenderNormal;
	m_nRenderFX = kRenderFxNone;
	
	// hopefully this will fix the VELOCITY TOO LOW crap
	m_takedamage = DAMAGE_EVENTS_ONLY;
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_STANDABLE );
	SetCollisionGroup( COLLISION_GROUP_DEBRIS );

	SetModel( szGibModel );

	SetNextThink( gpGlobals->curtime + 4 );
	m_lifeTime = 25;
	SetTouch ( &CGib::BounceGibTouch );

    m_bForceRemove = false;

	m_material = matNone;
	m_cBloodDecals = 5;// how many blood decals this gib can place (1 per bounce until none remain). 

}
예제 #9
0
void CSatchelCharge::Spawn( void )
{
	Precache( );
	SetModel( "models/Weapons/w_slam.mdl" );

	VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false );
	SetMoveType( MOVETYPE_VPHYSICS );

	SetCollisionGroup( COLLISION_GROUP_WEAPON );

	UTIL_SetSize(this, Vector( -6, -6, -2), Vector(6, 6, 2));

	SetThink( &CSatchelCharge::SatchelThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_plr_dmg_satchel.GetFloat();
	m_DmgRadius		= sk_satchel_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( 560 ) );	// slightly lower gravity
	SetFriction( 1.0 );
	SetSequence( 1 );
	SetDamage( 150 );

	m_bIsAttached			= false;
	m_bInAir				= true;
	m_flNextBounceSoundTime	= 0;

	m_vLastPosition	= vec3_origin;

	m_hGlowSprite = NULL;
	CreateEffects();
}
예제 #10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CResourceChunk::Spawn( )
{
	// Init model
	if ( IsProcessed() )
	{
		SetModelName( AllocPooledString( sProcessedResourceChunkModel ) );
	}
	else
	{
		SetModelName( AllocPooledString( sResourceChunkModel ) );
	}

	BaseClass::Spawn();

	UTIL_SetSize( this, Vector(-4,-4,-4), Vector(4,4,4) );
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_TRIGGER );
	CollisionProp()->UseTriggerBounds( true, 24 );
	SetCollisionGroup( TFCOLLISION_GROUP_RESOURCE_CHUNK );
	SetGravity( 1.0 );
	SetFriction( 1 );
	SetTouch( ChunkTouch );
	SetThink( ChunkRemove );
	SetNextThink( gpGlobals->curtime + random->RandomFloat( 50.0, 80.0 ) ); // Remove myself the
}
예제 #11
0
void CSatchelCharge::Spawn( void )
{
	Precache( );
	// motor
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX ); 
	SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
	SetModel( "models/Weapons/w_slam.mdl" );

	UTIL_SetSize(this, Vector( -6, -6, -2), Vector(6, 6, 2));

	SetTouch( SatchelTouch );
	SetUse( SatchelUse );
	SetThink( SatchelThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_plr_dmg_satchel.GetFloat();
	m_DmgRadius		= sk_satchel_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( 560 ) );	// slightly lower gravity
	SetFriction( 1.0 );
	SetSequence( 1 );

	m_bIsAttached			= false;
	m_bInAir				= true;
	m_flSlideVolume			= -1.0;
	m_flNextBounceSoundTime	= 0;

	m_vLastPosition	= vec3_origin;

	InitSlideSound();
}
예제 #12
0
void CGrenadeSpit::Spawn( void )
{
	Precache( );
	SetSolid( SOLID_BBOX );
	SetMoveType( MOVETYPE_FLYGRAVITY );

	// FIXME, if these is a sprite, then we need a base class derived from CSprite rather than
	// CBaseAnimating.  pev->scale becomes m_flSpriteScale in that case.
	SetModel( "models/spitball_large.mdl" );
	UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));

	m_nRenderMode		= kRenderTransAdd;
	SetRenderColor( 255, 255, 255, 255 );
	m_nRenderFX		= kRenderFxNone;

	SetThink( SpitThink );
	SetUse( DetonateUse );
	SetTouch( GrenadeSpitTouch );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_dmg_spit_grenade.GetFloat();
	m_DmgRadius		= sk_spit_grenade_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( SPIT_GRAVITY ) );
	SetFriction( 0.8 );
	SetSequence( 1 );

	SetCollisionGroup( HL2COLLISION_GROUP_SPIT );
}
void CObject_Player::ChangeCamera(ID3D11Device *pd3dDevice, DWORD nNewCameraMode, float fTimeElapsed)
{
	DWORD nCurrentCameraMode = (m_pCamera) ? m_pCamera->GetMode() : 0x00;
	if (nCurrentCameraMode == nNewCameraMode) return;
	switch (nNewCameraMode)
	{
		case FIRST_PERSON_CAMERA:            
//플레이어의 특성을 1인칭 카메라 모드에 맞게 변경한다. 중력은 적용하지 않는다.
            SetFriction(200.0f); 
            SetGravity(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            SetMaxVelocityXZ(125.0f);
            SetMaxVelocityY(400.0f);
            m_pCamera = OnChangeCamera(pd3dDevice, FIRST_PERSON_CAMERA, nCurrentCameraMode);
            m_pCamera->SetTimeLag(0.0f);
            m_pCamera->SetOffset(D3DXVECTOR3(0.0f, 20.0f, 0.0f));
            m_pCamera->GenerateProjectionMatrix(1.01f, 5000.0f, ASPECT_RATIO, 60.0f);
            break;
		case SPACESHIP_CAMERA:            
//플레이어의 특성을 스페이스-쉽 카메라 모드에 맞게 변경한다. 중력은 적용하지 않는다.
            SetFriction(125.0f); 
            SetGravity(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            SetMaxVelocityXZ(400.0f);
            SetMaxVelocityY(400.0f);
            m_pCamera = OnChangeCamera(pd3dDevice, SPACESHIP_CAMERA, nCurrentCameraMode);
            m_pCamera->SetTimeLag(0.0f);
            m_pCamera->SetOffset(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            m_pCamera->GenerateProjectionMatrix(1.01f, 5000.0f, ASPECT_RATIO, 60.0f);
            break;  
		case THIRD_PERSON_CAMERA:
//플레이어의 특성을 3인칭 카메라 모드에 맞게 변경한다. 지연 효과와 카메라 오프셋을 설정한다.
            SetFriction(250.0f); 
            SetGravity(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            SetMaxVelocityXZ(125.0f);
            SetMaxVelocityY(400.0f);
            m_pCamera = OnChangeCamera(pd3dDevice, THIRD_PERSON_CAMERA, nCurrentCameraMode);
            m_pCamera->SetTimeLag(0.25f);
            m_pCamera->SetOffset(D3DXVECTOR3(0.0f, 130.0f, -80.0f));
            m_pCamera->GenerateProjectionMatrix(1.01f, 5000.0f, ASPECT_RATIO, 60.0f);
            break;
		default:
            break;
	}
//카메라 정보를 시간에 따라 갱신한다.
	Update(fTimeElapsed);
}
예제 #14
0
BumperHitCircle::BumperHitCircle()
{
	m_bumperanim.m_fHitEvent = false;
    m_bumperanim.m_ringAnimOffset = 0.0f;
	m_elasticity = 0.3f;
    SetFriction(0.3f);
	m_scatter = 0;
	m_bumperanim.m_fVisible = true;
}
예제 #15
0
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPlayer_Control::Spawn( void )
{
	Precache();
	SetFriction( 0.55 ); // deading the bounce a bit
	
	m_bActive = false;

	CreateVPhysics();
}
예제 #16
0
LineSegSlingshot::LineSegSlingshot(const Vertex2D& p1, const Vertex2D& p2, const float _zlow, const float _zhigh)
    : LineSeg(p1, p2, _zlow, _zhigh)
{
	m_slingshotanim.m_iframe = 0;
	m_slingshotanim.m_TimeReset = 0; // zero means the slingshot is currently reset
	m_elasticity = 0.3f;
    SetFriction(0.3f);
	m_scatter = 0;
}
예제 #17
0
void CASW_Boomer_Blob::Spawn( void )
{
	//d:\dev\main\game\infested\models\swarm\mortarbugprojectile\mortarbugprojectile.mdl
	Precache();
	SetModel( ASW_BOOMER_BLOB_MODEL );
	
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );

	m_flDamage		= 80;
	m_DmgRadius		= 165.0f;  // NOTE: this gets overriden

	m_takedamage	= DAMAGE_NO;
	m_iHealth = 1;

	m_bModelOpening = false;

	SetSize( -Vector(4,4,4), Vector(4,4,4) );
	SetSolid( SOLID_BBOX );
	SetGravity( asw_boomer_blob_gravity.GetFloat() );
	SetFriction( asw_boomer_blob_friction.GetFloat() );
	SetElasticity( asw_vindicator_grenade_elasticity.GetFloat() );
	SetCollisionGroup( ASW_COLLISION_GROUP_PASSABLE );

	SetTouch( &CASW_Boomer_Blob::Touch );

	//CreateEffects();
	m_hFirer = NULL;

	// Tumble in air
	QAngle vecAngVelocity( random->RandomFloat ( -100, -500 ), 0, 0 );
	SetLocalAngularVelocity( vecAngVelocity );

	m_fEarliestAOEDetonationTime = GetEarliestAOEDetonationTime();
	m_fEarliestTouchDetonationTime = GetEarliestTouchDetonationTime();

	m_iClusters = 0;
	m_bMaster = true;	

	ResetSequence( LookupSequence( "MortarBugProjectile_Closed" ) );

	//EmitSound( "ASWGrenade.Alarm" );
	SetFuseLength( asw_boomer_blob_fuse.GetFloat() + RandomFloat( -0.25, 0.66f ) );	
	

	if ( m_fDetonateTime <= gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() )
	{
		SetThink( &CASW_Boomer_Blob::Detonate );
		SetNextThink( m_fDetonateTime );
	}
	else
	{
		SetThink( &CASW_Boomer_Blob::CheckNearbyTargets );
		SetNextThink( gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() );
	}
}
예제 #18
0
RigidBody::RigidBody(float x, float y, int width, int height)
{
	// Create a Rectangle shape - origin middle
	mShape = new Shape();
	mShape->setOrigin(Vector(x, y, 0));
	mShape->addPoint(Vector(-width/2, -height/2, 0));	// top - left
	mShape->addPoint(Vector(-width/2, height/2, 0));	// bottom - left
	mShape->addPoint(Vector(width/2, height/2, 0));		// bottom - right
	mShape->addPoint(Vector(width/2, -height/2, 0));	// top - right

	SetMass(1);
	SetVelocity(0, 0);
	SetAngularVelocity(0.0f);
	SetForce(Vector(0, 0, 0));
	SetTorque(Vector(0, 0, 0));
	SetFriction(1.0f);
	SetFriction(0.5f),
	SetSimulate(true);
	SetOwner(NULL);
	
}
예제 #19
0
Object::Object(float x, float y , String pathName, float sx, float sy)
{
	SetLayer(3);
	SetPosition(x, y);
	SetName("object");
	SetSprite(pathName);
	SetSize(sx, sy);
	SetDensity(0.0f);
	SetFriction(0.0f);
	SetRestitution(0.1f);
	InitPhysics();
}
예제 #20
0
Space::Space(size_t id) : ITurf(id)
{
    SetAtmosState(SPACE);

    SetPassable(D_ALL, Passable::FULL);
    transparent = true;
    
    SetFriction(0);

    SetSprite("icons/space.png"); 
    SetState("10");
    name = "Space";
}
예제 #21
0
void Player::Start()
{
	IsTrigger(true);
	SetGravity(0.0f);
	SetVelocity(0.0f,0.0f);
	SetFriction(0.1f);
	SetDamping(1.0f);
	SetAngularDamping(1.5f);
	lives = 3;
	SetState(NormalState);
	lookAtPoint = Vector2(2.0f, 2.0f);
	speed = 7.0f;
	firstFire = true;
}
예제 #22
0
void CSnark::Spawn( void )
{
	Precache();

	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_STANDABLE );
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );

	SetModel( "models/w_squeak.mdl" );
	UTIL_SetSize( this, Vector( -4, -4, 0 ), Vector( 4, 4, 8 ) );

	SetBloodColor( BLOOD_COLOR_YELLOW );

	SetTouch( &CSnark::SuperBounceTouch );
	SetThink( &CSnark::HuntThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flNextHit				= gpGlobals->curtime;
	m_flNextHunt			= gpGlobals->curtime + 1E6;
	m_flNextBounceSoundTime	= gpGlobals->curtime;

	AddFlag( FL_AIMTARGET | FL_NPC );
	m_takedamage = DAMAGE_YES;

	m_iHealth		= sk_snark_health.GetFloat();
	m_iMaxHealth	= m_iHealth;

	SetGravity( 0.5 );
	SetFriction( 0.5 );

	SetDamage( sk_snark_dmg_pop.GetFloat() );

	m_flDie = gpGlobals->curtime + SQUEEK_DETONATE_DELAY;

	m_flFieldOfView = 0; // 180 degrees

	if ( GetOwnerEntity() )
		m_hOwner = GetOwnerEntity();

	m_flNextBounceSoundTime = gpGlobals->curtime;// reset each time a snark is spawned.

	SetSequence( WSQUEAK_RUN );
	ResetSequenceInfo( );

	m_iMyClass = CLASS_NONE;

	m_posPrev = Vector( 0, 0, 0 );
}
예제 #23
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHarpoon::Spawn( void )
{
	Precache();

	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM );
	SetSolid( SOLID_BBOX );
	//m_flGravity = 1.0;
	SetFriction( 0.75 );
	SetModel( "models/weapons/w_harpoon.mdl" );
	UTIL_SetSize(this, Vector( -4, -4, -4), Vector(4, 4, 4));
	SetCollisionGroup( TFCOLLISION_GROUP_GRENADE );

	SetTouch( HarpoonTouch );
	SetThink( FlyThink );
	SetNextThink( gpGlobals->curtime + 0.1f );
}
예제 #24
0
void CGrenade_Molotov::Spawn( void )
{
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX ); 
	SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
	RemoveEffects( EF_NOINTERP );

	SetModel( "models/weapons/w_molotov.mdl");

	UTIL_SetSize(this, Vector( -6, -6, -2), Vector(6, 6, 2));

	SetTouch( MolotovTouch );
	SetThink( MolotovThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_plr_dmg_molotov.GetFloat();
	m_DmgRadius		= sk_molotov_radius.GetFloat();

	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetGravity( 1.0 );
	SetFriction( 0.8 );  // Give a little bounce so can flatten
	SetSequence( 1 );

	m_pFireTrail = SmokeTrail::CreateSmokeTrail();

	if( m_pFireTrail )
	{
		m_pFireTrail->m_SpawnRate			= 48;
		m_pFireTrail->m_ParticleLifetime	= 1.0f;
		
		m_pFireTrail->m_StartColor.Init( 0.2f, 0.2f, 0.2f );
		m_pFireTrail->m_EndColor.Init( 0.0, 0.0, 0.0 );
		
		m_pFireTrail->m_StartSize	= 8;
		m_pFireTrail->m_EndSize		= 32;
		m_pFireTrail->m_SpawnRadius	= 4;
		m_pFireTrail->m_MinSpeed	= 8;
		m_pFireTrail->m_MaxSpeed	= 16;
		m_pFireTrail->m_Opacity		= 0.25f;

		m_pFireTrail->SetLifetime( 20.0f );
		m_pFireTrail->FollowEntity( this, "0" );
	}
}
예제 #25
0
CharActor::CharActor(const String& maskPath, const Vector2 size)
	: PhysicsActor()
	//, m_mask(maskPath)
	, m_direction(SOUTH)
	, m_moving(false)
	, m_movingNorth(false)
	, m_movingEast(false)
	, m_movingSouth(false)
	, m_movingWest(false)
	, m_movementSpeed(100.0f)	//3.0f
	, m_idleness(0.0f)
	, m_idleAnim(false)
	//, m_isKinematic(true)
{
    m_mask = thePixelArthGame.m_collHandler->GetBitmask(maskPath);
	//SetName("Arth");
	//SetColor(1.0f, 1.0f, 1.0f, 1.0f);
	SetSize(size.X, size.Y);
	//_mask->setSizeInWorldUnits(size);

	SetDensity(1.0f);
	SetFriction(0.0f);
	SetRestitution(0.0f);
	SetIsSensor(true);
	SetFixedRotation(true);
	InitPhysics();
	
	//_timestampArrowReleased = theWorld.GetCurrentTimeSeconds();

	//ClearSpriteInfo();
	SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png");

	theSwitchboard.SubscribeTo(this, "CameraChange");
	theSwitchboard.SubscribeTo(this, "UpArrowPressed");
	theSwitchboard.SubscribeTo(this, "DownArrowPressed");
	theSwitchboard.SubscribeTo(this, "LeftArrowPressed");
	theSwitchboard.SubscribeTo(this, "RightArrowPressed");
	theSwitchboard.SubscribeTo(this, "UpArrowReleased");
	theSwitchboard.SubscribeTo(this, "DownArrowReleased");
	theSwitchboard.SubscribeTo(this, "LeftArrowReleased");
	theSwitchboard.SubscribeTo(this, "RightArrowReleased");

	///TEST
	//_world = new Bitmask("Resources/Images/coll.png");
}
예제 #26
0
void CASW_Bait::Spawn( void )
{
	Precache( );

	SetModel( BAIT_MODEL );
	UTIL_SetSize( this, Vector( -2, -2, -2 ), Vector( 2, 2, 2 ) );
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_SOLID );

	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );

	m_takedamage	= DAMAGE_NO;

	SetFriction( 0.6f );
	m_flTimeBurnOut = gpGlobals->curtime + 30;

	AddEffects( EF_NOSHADOW|EF_NORECEIVESHADOW );

	AddFlag( FL_OBJECT );
	
	SetCollisionGroup( ASW_COLLISION_GROUP_IGNORE_NPCS );
	//CreateVPhysics();

	// Tumble in air
	QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 );
	SetLocalAngularVelocity( vecAngVelocity );

	SetTouch( &CASW_Bait::BaitTouch );	
	SetThink( &CASW_Bait::BaitThink );

	// join the flares team so that aliens will hate us
	ChangeFaction( FACTION_BAIT );

	if ( ASW_BAIT_LIFETIME > 0 )
	{
		m_flTimeBurnOut = gpGlobals->curtime + ASW_BAIT_LIFETIME;
	}
	else
	{
		m_flTimeBurnOut = -1.0f;
	}		
	SetNextThink( gpGlobals->curtime + 0.1f );

	g_AI_SensedObjectsManager.AddEntity( this );
}
예제 #27
0
Cliff_Small::Cliff_Small(Vector2 startingPosition) {
    int zoom = ((ShapeGameManager*)theWorld.GetGameManager())->WorldZoom * 2;
    SetSize(zoom);

    SetPosition(startingPosition);

    // SetSprite("Resources/Images/sa_cliff_small.png");

    SetDensity(0.0f);
    SetFriction(0.5f);
    SetRestitution(0.0f);
    SetShapeType(PhysicsActor::SHAPETYPE_BOX);
    SetColor(1.0f, 1.0f, 0.5f, 1.0f);

    InitPhysics();

    Tag("ground");
}
예제 #28
0
//-----------------------------------------------------------------------------
// Purpose: Setup basic values for Thrown grens
//-----------------------------------------------------------------------------
void CThrownGrenade::Spawn( void )
{
	// point sized, solid, bouncing
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX );
	UTIL_SetSize(this, vec3_origin, vec3_origin);

	// Movement
	SetGravity( UTIL_ScaleForGravity( 648 ) );
	SetFriction(0.6);
	QAngle angles;
	VectorAngles( GetAbsVelocity(), angles );
	SetLocalAngles( angles );
	QAngle vecAngVel( random->RandomFloat ( -100, -500 ), 0, 0 );
	SetLocalAngularVelocity( vecAngVel );
	
	SetTouch( &CThrownGrenade::BounceTouch );
}
예제 #29
0
FinishLine::FinishLine(Vector2 startingPosition) {
  int zoom = ((ShapeGameManager*)theWorld.GetGameManager())->WorldZoom;
  SetSize(zoom * 1.75, zoom * 2);

  SetPosition(startingPosition);

  SetSprite("Resources/Images/sa_finish_line.png");
  // SetUVs(Vector2(0.0f, 0.0f), Vector2(7.0f, 5.0f));

  SetDensity(0.0f);
  SetFriction(0.5f);
  SetRestitution(0.0f);
  SetShapeType(PhysicsActor::SHAPETYPE_BOX);
  SetColor(1.0f, 1.0f, 1.0f, 1.0f);

  // InitPhysics();

  Tag("ground");
}
예제 #30
0
/*
================
rvPhysics_Particle::rvPhysics_Particle
================
*/
rvPhysics_Particle::rvPhysics_Particle( void ) {
	SetClipMask( MASK_SOLID );
	SetBouncyness( 0.6f, true );
	clipModel = NULL;

	memset( &current, 0, sizeof( current ) );
	current.atRest = -1;
	current.origin.Zero();
	saved = current;

	dropToFloor		= false;
	testSolid		= false;
	hasMaster		= false;
	
	SetFriction( 0.6f, 0.6f, 0.0f );
	SetBouncyness ( 0.5f, true );
		
	gravityNormal.Zero();
}