• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AngleMatrix函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AngleMatrix函数的典型用法代码示例。如果您正苦于以下问题:C++ AngleMatrix函数的具体用法?C++ AngleMatrix怎么用?C++ AngleMatrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AngleMatrix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Assert

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropServerVehicleManhack::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV )
{
	Assert( nRole == VEHICLE_ROLE_DRIVER );
	CBasePlayer *pPlayer = ToBasePlayer( GetDrivableVehicle()->GetDriver() );
	Assert( pPlayer );//*/

	//commented out because this really should be setting the manhack angle, not the vehicle angle
	*pAbsAngles = pPlayer->EyeAngles(); // yuck. this is an in/out parameter.
	//*pAbsOrigin = pPlayer->EyePosition();

	CNPC_Manhack *pManhack=NULL;

	if (GetManhack())
		pManhack=GetManhack()->GetManhack();
	
	if (pManhack != NULL) 
	{
		Vector  m_vecManhackEye = GetManhack()->GetManhackEyePosition(); //pManhack->GetManhackView();
		QAngle m_angManhackEye = pManhack->GetAbsAngles();

		matrix3x4_t vehicleEyePosToWorld;

		AngleMatrix( m_angManhackEye, vehicleEyePosToWorld );

		// Dampen the eye positional change as we drive around.
		//*pAbsAngles = pPlayer->EyeAngles();

		CPropVehicleManhack *pDriveable = assert_cast<CPropVehicleManhack*>(GetDrivableVehicle());
		if (pDriveable) pDriveable->DampenEyePosition( m_vecManhackEye, m_angManhackEye );
	
		// Compute the relative rotation between the unperturbed eye attachment + the eye angles
		matrix3x4_t cameraToWorld;
		AngleMatrix( *pAbsAngles, cameraToWorld );

		matrix3x4_t worldToEyePos;
		MatrixInvert( vehicleEyePosToWorld, worldToEyePos );

		matrix3x4_t vehicleCameraToEyePos;
		ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos );

		AngleMatrix( m_angManhackEye, m_vecManhackEye, vehicleEyePosToWorld );

		// Now treat the relative eye angles as being relative to this new, perturbed view position...
		matrix3x4_t newCameraToWorld;
		ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld );

		// output new view abs angles
		MatrixAngles( newCameraToWorld, *pAbsAngles );

		// UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics
		MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin );

	} else DevMsg("fail\n");
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:57,代码来源:vehicle_manhack.cpp


示例2: Assert

void CAPC2FourWheelServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles )
{
	//FixMe, wtf?
	#ifndef DEBUG
	Assert( nRole == VEHICLE_DRIVER );
	#endif
	CBaseCombatCharacter *pPlayer = GetPassenger( VEHICLE_ROLE_DRIVER );
	Assert( pPlayer );

	float flPitchFactor=1.0;
	*pAbsAngles = pPlayer->EyeAngles();
	matrix3x4_t vehicleEyePosToWorld;
	Vector vehicleEyeOrigin;
	QAngle vehicleEyeAngles;
	GetAPC()->GetAttachment( "cannon_muzzle", vehicleEyeOrigin, vehicleEyeAngles );
	Vector up,forward;
	GetAPC()->GetVectors(NULL,&forward,&up);
	vehicleEyeOrigin+=(forward*37)+(up*35);
	AngleMatrix( vehicleEyeAngles, vehicleEyePosToWorld );

//#ifdef HL2_DLL
//	// View dampening.
//	if ( r_VehicleViewDampen.GetInt() )
//	{
//		GetAPC()->DampenEyePosition( vehicleEyeOrigin, vehicleEyeAngles );
//	}
//#endif

	// Compute the relative rotation between the unperterbed eye attachment + the eye angles
	matrix3x4_t cameraToWorld;
	AngleMatrix( *pAbsAngles, cameraToWorld );

	matrix3x4_t worldToEyePos;
	MatrixInvert( vehicleEyePosToWorld, worldToEyePos );

	matrix3x4_t vehicleCameraToEyePos;
	ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos );

	// Now perterb the attachment point
	vehicleEyeAngles.x = RemapAngleRange( PITCH_CURVE_ZERO * flPitchFactor, PITCH_CURVE_LINEAR, vehicleEyeAngles.x );
	vehicleEyeAngles.z = RemapAngleRange( ROLL_CURVE_ZERO * flPitchFactor, ROLL_CURVE_LINEAR, vehicleEyeAngles.z );
	AngleMatrix( vehicleEyeAngles, vehicleEyeOrigin, vehicleEyePosToWorld );

	// Now treat the relative eye angles as being relative to this new, perterbed view position...
	matrix3x4_t newCameraToWorld;
	ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld );

	// output new view abs angles
	MatrixAngles( newCameraToWorld, *pAbsAngles );

	// UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics
	MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin );
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:53,代码来源:vehicle_apc2.cpp


示例3: Assert

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CChoreoGenericServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*= NULL*/ )
{
	// FIXME: This needs to be reconciled with the other versions of this function!
	Assert( nRole == VEHICLE_ROLE_DRIVER );
	CBasePlayer *pPlayer = ToBasePlayer( GetDrivableVehicle()->GetDriver() );
	Assert( pPlayer );

	// Use the player's eyes instead of the attachment point
	if ( GetVehicle()->m_bForcePlayerEyePoint )
	{
		// Call to BaseClass because CBasePlayer::EyePosition calls this function.
	  *pAbsOrigin = pPlayer->CBaseCombatCharacter::EyePosition();
	  *pAbsAngles = pPlayer->CBaseCombatCharacter::EyeAngles();
		return;
	}

	*pAbsAngles = pPlayer->EyeAngles(); // yuck. this is an in/out parameter.

	float flPitchFactor = 1.0;
	matrix3x4_t vehicleEyePosToWorld;
	Vector vehicleEyeOrigin;
	QAngle vehicleEyeAngles;
	GetVehicle()->GetAttachment( "vehicle_driver_eyes", vehicleEyeOrigin, vehicleEyeAngles );
	AngleMatrix( vehicleEyeAngles, vehicleEyePosToWorld );

	// Compute the relative rotation between the unperterbed eye attachment + the eye angles
	matrix3x4_t cameraToWorld;
	AngleMatrix( *pAbsAngles, cameraToWorld );

	matrix3x4_t worldToEyePos;
	MatrixInvert( vehicleEyePosToWorld, worldToEyePos );

	matrix3x4_t vehicleCameraToEyePos;
	ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos );

	// Now perterb the attachment point
	vehicleEyeAngles.x = RemapAngleRange( PITCH_CURVE_ZERO * flPitchFactor, PITCH_CURVE_LINEAR, vehicleEyeAngles.x );
	vehicleEyeAngles.z = RemapAngleRange( ROLL_CURVE_ZERO * flPitchFactor, ROLL_CURVE_LINEAR, vehicleEyeAngles.z );

	AngleMatrix( vehicleEyeAngles, vehicleEyeOrigin, vehicleEyePosToWorld );

	// Now treat the relative eye angles as being relative to this new, perterbed view position...
	matrix3x4_t newCameraToWorld;
	ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld );

	// output new view abs angles
	MatrixAngles( newCameraToWorld, *pAbsAngles );

	// UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics
	MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin );
}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:54,代码来源:vehicle_choreo_generic.cpp


示例4: AngleMatrix

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CASW_Prediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, 
	CMoveData *move )
{
	// Call the default SetupMove code.
	BaseClass::SetupMove( player, ucmd, pHelper, move );
	
	CASW_Player *pASWPlayer = static_cast<CASW_Player*>( player );
	if ( !asw_allow_detach.GetBool() )
	{		
		if ( pASWPlayer && pASWPlayer->GetMarine() )
		{
			// this forces horizontal movement
			move->m_vecAngles.x = 0;
			move->m_vecViewAngles.x = 0;
		}
	}

	CBaseEntity *pMoveParent = player->GetMoveParent();
	if (!pMoveParent)
	{
		move->m_vecAbsViewAngles = move->m_vecViewAngles;
	}
	else
	{
		matrix3x4_t viewToParent, viewToWorld;
		AngleMatrix( move->m_vecViewAngles, viewToParent );
		ConcatTransforms( pMoveParent->EntityToWorldTransform(), viewToParent, viewToWorld );
		MatrixAngles( viewToWorld, move->m_vecAbsViewAngles );
	}
	CASW_MoveData *pASWMove = static_cast<CASW_MoveData*>( move );
	pASWMove->m_iForcedAction = ucmd->forced_action;
	// setup trace optimization
	g_pGameMovement->SetupMovementBounds( move );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:37,代码来源:asw_prediction.cpp


示例5: AngleDistance

void CPlayerPickupController::ComputePlayerMatrix( matrix3x4_t &out )
{
	QAngle angles = m_pPlayer->EyeAngles();
	Vector origin = m_pPlayer->EyePosition();
	
	// 0-360 / -180-180
	angles.x = AngleDistance( angles.x, 0 );
	angles.x = clamp( angles.x, -PLAYER_LOOK_PITCH_RANGE, PLAYER_LOOK_PITCH_RANGE );

	float feet = m_pPlayer->GetAbsMins().z;
	float eyes = origin.z;
	float zoffset = 0;
	// moving up (negative pitch is up)
	if ( angles.x < 0 )
	{
		zoffset = RemapVal( angles.x, 0, -PLAYER_LOOK_PITCH_RANGE, PLAYER_HOLD_LEVEL_EYES, PLAYER_HOLD_UP_EYES );
	}
	else
	{
		zoffset = RemapVal( angles.x, 0, PLAYER_LOOK_PITCH_RANGE, PLAYER_HOLD_LEVEL_EYES, PLAYER_HOLD_DOWN_FEET + (feet - eyes) );
	}
//	origin.z += zoffset;
	angles.x = 0;
	AngleMatrix( angles, origin, out );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:25,代码来源:hl1_player.cpp


示例6: VPROF

//-----------------------------------------------------------------------------
// Purpose: Prepares for running movement
// Input  : *player - 
//			*ucmd - 
//			*pHelper - 
//			*move - 
//			time - 
//-----------------------------------------------------------------------------
void CPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move )
{
	VPROF( "CPlayerMove::SetupMove" );

	// Allow sound, etc. to be created by movement code
	move->m_bFirstRunOfFunctions = true;

	// Prepare the usercmd fields
	move->m_nImpulseCommand		= ucmd->impulse;	
	move->m_vecViewAngles		= ucmd->viewangles;

	CBaseEntity *pMoveParent = player->GetMoveParent();
	if (!pMoveParent)
	{
		move->m_vecAbsViewAngles = move->m_vecViewAngles;
	}
	else
	{
		matrix3x4_t viewToParent, viewToWorld;
		AngleMatrix( move->m_vecViewAngles, viewToParent );
		ConcatTransforms( pMoveParent->EntityToWorldTransform(), viewToParent, viewToWorld );
		MatrixAngles( viewToWorld, move->m_vecAbsViewAngles );
	}

	move->m_nButtons			= ucmd->buttons;

	// Ingore buttons for movement if at controls
	if ( player->GetFlags() & FL_ATCONTROLS )
	{
		move->m_flForwardMove		= 0;
		move->m_flSideMove			= 0;
		move->m_flUpMove				= 0;
	}
	else
	{
		move->m_flForwardMove		= ucmd->forwardmove;
		move->m_flSideMove			= ucmd->sidemove;
		move->m_flUpMove				= ucmd->upmove;
	}

	// Prepare remaining fields
	move->m_flClientMaxSpeed		= player->m_flMaxspeed;
	move->m_nOldButtons			= player->m_Local.m_nOldButtons;
	move->m_vecAngles			= player->pl.v_angle;

	move->m_vecVelocity			= player->GetAbsVelocity();

	move->m_nPlayerHandle		= player;

	move->m_vecAbsOrigin		= player->GetAbsOrigin();

	// Copy constraint information
	if ( player->m_hConstraintEntity.Get() )
		move->m_vecConstraintCenter = player->m_hConstraintEntity.Get()->GetAbsOrigin();
	else
		move->m_vecConstraintCenter = player->m_vecConstraintCenter;
	move->m_flConstraintRadius = player->m_flConstraintRadius;
	move->m_flConstraintWidth = player->m_flConstraintWidth;
	move->m_flConstraintSpeedFactor = player->m_flConstraintSpeedFactor;
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:68,代码来源:player_command.cpp


示例7: FindJointByName

void msModel::SetupJoints()
{
	for (size_t i = 0; i < m_joints.size(); i++)
	{
		ms3d_joint_t *joint = &m_joints[i];
		joint->parentIndex = FindJointByName(joint->parentName);
	}

	for (size_t i = 0; i < m_joints.size(); i++)
	{
		ms3d_joint_t *joint = &m_joints[i];
		AngleMatrix(joint->rot, joint->matLocalSkeleton);
		joint->matLocalSkeleton[0][3]= joint->pos[0];
		joint->matLocalSkeleton[1][3]= joint->pos[1];
		joint->matLocalSkeleton[2][3]= joint->pos[2];

		if (joint->parentIndex == -1)
		{
			memcpy(joint->matGlobalSkeleton, joint->matLocalSkeleton, sizeof(joint->matGlobalSkeleton));
		}
		else
		{
			ms3d_joint_t *parentJoint = &m_joints[joint->parentIndex];
			R_ConcatTransforms(parentJoint->matGlobalSkeleton, joint->matLocalSkeleton, joint->matGlobalSkeleton);
		}

		SetupTangents();
	}
}
开发者ID:PinSimDB,项目名称:fp-addons-sdk,代码行数:29,代码来源:msModel.cpp


示例8: AlignAngles

static QAngle AlignAngles( const QAngle &angles, float cosineAlignAngle )
{
	matrix3x4_t alignMatrix;
	AngleMatrix( angles, alignMatrix );

	// NOTE: Must align z first
	for ( int j = 3; --j >= 0; )
	{
		Vector vec;
		MatrixGetColumn( alignMatrix, j, vec );
		for ( int i = 0; i < 3; i++ )
		{
			if ( fabs(vec[i]) > cosineAlignAngle )
			{
				vec[i] = SIGN(vec[i]);
				vec[(i+1)%3] = 0;
				vec[(i+2)%3] = 0;
				MatrixSetColumn( vec, j, alignMatrix );
				MatrixOrthogonalize( alignMatrix, j );
				break;
			}
		}
	}

	QAngle out;
	MatrixAngles( alignMatrix, out );
	return out;
}
开发者ID:gamenew09,项目名称:SourceSDK2010,代码行数:28,代码来源:player_pickup_controller.cpp


示例9: ComputePlayerMatrix

static void ComputePlayerMatrix( CBasePlayer *pPlayer, matrix3x4_t &out )
{
	if ( !pPlayer )
		return;

	QAngle angles = pPlayer->EyeAngles();
	Vector origin = pPlayer->EyePosition();
	
	// 0-360 / -180-180
	//angles.x = init ? 0 : AngleDistance( angles.x, 0 );
	//angles.x = clamp( angles.x, -PLAYER_LOOK_PITCH_RANGE, PLAYER_LOOK_PITCH_RANGE );
	angles.x = 0;

	float feet = pPlayer->GetAbsOrigin().z + pPlayer->WorldAlignMins().z;
	float eyes = origin.z;
	float zoffset = 0;
	// moving up (negative pitch is up)
	if ( angles.x < 0 )
	{
		zoffset = RemapVal( angles.x, 0, -PLAYER_LOOK_PITCH_RANGE, PLAYER_HOLD_LEVEL_EYES, PLAYER_HOLD_UP_EYES );
	}
	else
	{
		zoffset = RemapVal( angles.x, 0, PLAYER_LOOK_PITCH_RANGE, PLAYER_HOLD_LEVEL_EYES, PLAYER_HOLD_DOWN_FEET + (feet - eyes) );
	}
	origin.z += zoffset;
	angles.x = 0;
	AngleMatrix( angles, origin, out );
}
开发者ID:gamenew09,项目名称:SourceSDK2010,代码行数:29,代码来源:player_pickup_controller.cpp


示例10: GetRoleAbsViewPosition

//-----------------------------------------------------------------------------
// Returns the unperterbed view position for a particular role
//-----------------------------------------------------------------------------
bool CBaseTFVehicle::GetRoleViewPosition( int nRole, Vector *pVehicleEyeOrigin, QAngle *pVehicleEyeAngles )
{
	// Generate the view position in world space.
	Vector vAbsOrigin;
	QAngle vAbsAngle;
	bool bUsingThirdPersonCamera = GetRoleAbsViewPosition( nRole, &vAbsOrigin, &vAbsAngle );

	
	// Make a matrix for it.
	matrix3x4_t absMatrix;
	AngleMatrix( vAbsAngle, absMatrix );
	MatrixSetColumn( vAbsOrigin, 3, absMatrix );


	// Transform the matrix into local space.
	matrix3x4_t worldToEntity, local;
	MatrixInvert( EntityToWorldTransform(), worldToEntity );
	ConcatTransforms( worldToEntity, absMatrix, local ); 


	// Suck out the origin and angles.
	pVehicleEyeOrigin->Init( local[0][3], local[1][3], local[2][3] );
	MatrixAngles( local, *pVehicleEyeAngles );

	return bUsingThirdPersonCamera;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:29,代码来源:basetfvehicle.cpp


示例11: VectorRotate

inline void VectorRotate(const Vector &i, const Angle &angles, Vector &o)
{
	matrix3x4 matrix;

	AngleMatrix(angles, matrix);
	VectorRotate(i, matrix, o);
}
开发者ID:TSM-Dev,项目名称:nh30,代码行数:7,代码来源:vector.hpp


示例12: AngleMatrix

void C_BaseViewModel::ApplyBoneMatrixTransform( matrix3x4_t& transform )
{
	if ( ShouldFlipViewModel() )
	{
		matrix3x4_t viewMatrix, viewMatrixInverse;

		// We could get MATERIAL_VIEW here, but this is called sometimes before the renderer
		// has set that matrix. Luckily, this is called AFTER the CViewSetup has been initialized.
		const CViewSetup *pSetup = view->GetPlayerViewSetup();
		AngleMatrix( pSetup->angles, pSetup->origin, viewMatrixInverse );
		MatrixInvert( viewMatrixInverse, viewMatrix );

		// Transform into view space.
		matrix3x4_t temp, temp2;
		ConcatTransforms( viewMatrix, transform, temp );
		
		// Flip it along X.
		
		// (This is the slower way to do it, and it equates to negating the top row).
		//matrix3x4_t mScale;
		//SetIdentityMatrix( mScale );
		//mScale[0][0] = 1;
		//mScale[1][1] = -1;
		//mScale[2][2] = 1;
		//ConcatTransforms( mScale, temp, temp2 );
		temp[1][0] = -temp[1][0];
		temp[1][1] = -temp[1][1];
		temp[1][2] = -temp[1][2];
		temp[1][3] = -temp[1][3];

		// Transform back out of view space.
		ConcatTransforms( viewMatrixInverse, temp, transform );
	}
}
开发者ID:malortie,项目名称:ulaval,代码行数:34,代码来源:c_baseviewmodel.cpp


示例13: VectorCopy

//-----------------------------------------------------------------------------
// Initialization
//-----------------------------------------------------------------------------
bool CStaticProp::Init( int index, StaticPropLump_t &lump, model_t *pModel )
{
	m_EntHandle = index | STATICPROP_EHANDLE_MASK; 
	m_Partition = PARTITION_INVALID_HANDLE;

	VectorCopy( lump.m_Origin, m_Origin );
	VectorCopy( lump.m_Angles, m_Angles );
	m_pModel = pModel;
	m_FirstLeaf = lump.m_FirstLeaf;
	m_LeafCount = lump.m_LeafCount;
	m_nSolidType = lump.m_Solid;
	m_Alpha = 255;
	m_Skin = (unsigned char)lump.m_Skin;

	// Cache the collision bounding box since it'll never change.
	modelinfo->GetModelRenderBounds( m_pModel, 0, m_RenderBBoxMin, m_RenderBBoxMax );

	// Cache the model to world matrix since it never changes.
	AngleMatrix( lump.m_Angles, lump.m_Origin, m_ModelToWorld );

	// FIXME: Sucky, but unless we want to re-read the static prop lump when the client is
	// initialized (possible, but also gross), we need to cache off the illum center now
	if (lump.m_Flags & STATIC_PROP_USE_LIGHTING_ORIGIN)
	{
		m_LightingOrigin = lump.m_LightingOrigin;
	}
	else
	{
		modelinfo->GetIlluminationPoint( m_pModel, m_Origin, m_Angles, &m_LightingOrigin );
	}

	return true;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:36,代码来源:staticpropmgr.cpp


示例14: AngleMatrix

CASW_Laser_Mine* CASW_Laser_Mine::ASW_Laser_Mine_Create( const Vector &position, const QAngle &angles, const QAngle &angLaserAim, CBaseEntity *pOwner, CBaseEntity *pMoveParent, bool bFriendly, CBaseEntity *pCreatorWeapon )
{
	CASW_Laser_Mine *pMine = (CASW_Laser_Mine*)CreateEntityByName( "asw_laser_mine" );
	pMine->SetLaserAngle( angLaserAim );
	
	matrix3x4_t wallMatrix;
	AngleMatrix( angles, wallMatrix );

	QAngle angRotateMine( 0, 90, 90 );
	matrix3x4_t fRotateMatrix;
	AngleMatrix( angRotateMine, fRotateMatrix );

	matrix3x4_t finalMatrix;
	QAngle angMine;
	ConcatTransforms( wallMatrix, fRotateMatrix, finalMatrix );
	MatrixAngles( finalMatrix, angMine );

	Vector vecSrc = pOwner->WorldSpaceCenter();
	CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>( pOwner );
	if ( pMarine )
		vecSrc = pMarine->GetOffhandThrowSource();
	pMine->SetAbsAngles( -angMine );
	pMine->Spawn();
	pMine->SetOwnerEntity( pOwner );
	UTIL_SetOrigin( pMine, vecSrc );
	pMine->m_bFriendly = bFriendly;
	pMine->m_hCreatorWeapon.Set( pCreatorWeapon );

	// adjust throw duration based on distance and some randomness
	float flDist = vecSrc.DistTo( position );
	const float flBaseDist = 90.0f;
	float flDistFraction = ( flDist / flBaseDist );
	flDistFraction = clamp<float>( flDistFraction, 0.5f, 2.0f );
	flDistFraction += RandomFloat( 0.0f, 0.2f );
	pMine->StartSpawnFlipping( vecSrc, position, angMine, 0.30f * flDistFraction );

	if( pCreatorWeapon )
		pMine->m_CreatorWeaponClass = pCreatorWeapon->Classify();

	if ( pMoveParent )
	{
		pMine->SetParent( pMoveParent );
		gEntList.AddListenerEntity( pMine );
	}

	return pMine;
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:47,代码来源:asw_laser_mine.cpp


示例15: R_StudioGetLightingCenter

//-----------------------------------------------------------------------------
// Gets the lighting center
//-----------------------------------------------------------------------------
static void R_StudioGetLightingCenter( studiohdr_t* pStudioHdr, const Vector& origin,
								const QAngle & angles, Vector* pLightingOrigin )
{
	Assert( pLightingOrigin );
	matrix3x4_t matrix;
	AngleMatrix( angles, origin, matrix );
	R_StudioCenter( pStudioHdr, matrix, *pLightingOrigin );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:11,代码来源:ModelInfo.cpp


示例16: AngleMatrix

QAngle CGravControllerPoint::TransformAnglesFromPlayerSpace( const QAngle &anglesIn, CBasePlayer *pPlayer )
{
	matrix3x4_t test;
	QAngle angleTest = pPlayer->EyeAngles();
	angleTest.x = 0;
	AngleMatrix( angleTest, test );
	return TransformAnglesToWorldSpace( anglesIn, test );
}
开发者ID:SCell555,项目名称:source-sdk-2013,代码行数:8,代码来源:weapon_physgun.cpp


示例17: GetModelPtr

void CRagdollPropAttached::InitRagdollAttached( IPhysicsObject *pAttached, const Vector &forceVector, int forceBone, matrix3x4_t *pPrevBones, matrix3x4_t *pBoneToWorld, float dt, int collisionGroup, CBaseAnimating *pFollow, int boneIndexRoot, const Vector &boneLocalOrigin, int parentBoneAttach, const Vector &worldAttachOrigin )
{
	int ragdollAttachedIndex = 0;
	if ( parentBoneAttach > 0 )
	{
		studiohdr_t *pStudioHdr = GetModelPtr();
		mstudiobone_t *pBone = pStudioHdr->pBone( parentBoneAttach );
		ragdollAttachedIndex = pBone->physicsbone;
	}

	InitRagdoll( forceVector, forceBone, vec3_origin, pPrevBones, pBoneToWorld, dt, collisionGroup, false );
	
	IPhysicsObject *pRefObject = m_ragdoll.list[ragdollAttachedIndex].pObject;

	Vector attachmentPointRagdollSpace;
	pRefObject->WorldToLocal( attachmentPointRagdollSpace, worldAttachOrigin );

	constraint_ragdollparams_t constraint;
	constraint.Defaults();
	matrix3x4_t tmp, worldToAttached, worldToReference, constraintToWorld;

	Vector offsetWS;
	pAttached->LocalToWorld( offsetWS, boneLocalOrigin );

	AngleMatrix( QAngle(0, pFollow->GetAbsAngles().y, 0 ), offsetWS, constraintToWorld );

	constraint.axes[0].SetAxisFriction( -2, 2, 20 );
	constraint.axes[1].SetAxisFriction( 0, 0, 0 );
	constraint.axes[2].SetAxisFriction( -15, 15, 20 );
	
	pAttached->GetPositionMatrix( tmp );
	MatrixInvert( tmp, worldToAttached );

	pRefObject->GetPositionMatrix( tmp );
	MatrixInvert( tmp, worldToReference );

	ConcatTransforms( worldToReference, constraintToWorld, constraint.constraintToReference );
	ConcatTransforms( worldToAttached, constraintToWorld, constraint.constraintToAttached );

	// for now, just slam this to be the passed in value
	MatrixSetColumn( attachmentPointRagdollSpace, 3, constraint.constraintToReference );

	DisableCollisions( pAttached );
	m_pAttachConstraint = physenv->CreateRagdollConstraint( pRefObject, pAttached, m_ragdoll.pGroup, constraint );

	FollowEntity( pFollow );
	SetOwnerEntity( pFollow );
	RagdollActivate( m_ragdoll );

	Relink();
	m_boneIndexAttached = boneIndexRoot;
	m_ragdollAttachedObjectIndex = ragdollAttachedIndex;
	m_attachmentPointBoneSpace = boneLocalOrigin;
	
	Vector vTemp;
	MatrixGetColumn( constraint.constraintToReference, 3, vTemp );
	m_attachmentPointRagdollSpace = vTemp;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:58,代码来源:physics_prop_ragdoll.cpp


示例18: UTIL_PlayerByIndex

void NDebugOverlay::BoxAngles(const Vector &origin, const Vector &mins, const Vector &maxs, const QAngle &angles, int r, int g, int b, int a, float duration)
{
	// --------------------------------------------------------------
	// Have to do clip the boxes before sending so we 
	// don't overflow the client message buffer 
	// --------------------------------------------------------------
	CBasePlayer *player = UTIL_PlayerByIndex(1);
	if ( !player )
		return;

	// ------------------------------------
	// Clip boxes that are far away
	// ------------------------------------
	if ((player->GetAbsOrigin() - origin).LengthSqr() > MAX_OVERLAY_DIST_SQR) 
		return;

	// ------------------------------------
	// Clip boxes that are behind the client 
	// ------------------------------------
	Vector clientForward;
	player->EyeVectors( &clientForward );

	// Build a rotation matrix from orientation
	matrix3x4_t fRotateMatrix;
	AngleMatrix(angles, fRotateMatrix);
	
	// Transform the mins and maxs
	Vector tmins, tmaxs;
	VectorRotate( mins, fRotateMatrix, tmins);
	VectorAdd(tmins,origin,tmins);
	VectorRotate( maxs, fRotateMatrix, tmaxs);
	VectorAdd(tmaxs,origin,tmaxs);

	Vector toMins  = tmins - player->GetAbsOrigin();
	Vector toMaxs  = tmaxs - player->GetAbsOrigin();
 	float  dotMins	 = DotProduct(clientForward,toMins);
 	float  dotMaxs	 = DotProduct(clientForward,toMaxs);
	if (dotMins < 0 && dotMaxs < 0)
		return;

	CSingleUserRecipientFilter user( player );

	MessageBegin( user, SVC_DEBUG_BOX_OVERLAY );
		WRITE_VEC3COORD(origin);
		WRITE_VEC3COORD(mins);
		WRITE_VEC3COORD(maxs);
		WRITE_ANGLES(angles); 
		WRITE_SHORT(r);
		WRITE_SHORT(g);
		WRITE_SHORT(b);
		WRITE_SHORT(a);
		WRITE_FLOAT(duration);
	MessageEnd();

}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:55,代码来源:ndebugoverlay.cpp


示例19: DEG2RAD

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : flConvergencePerc - 
//			vecBasis - 
//-----------------------------------------------------------------------------
void CNPC_Combine_Cannon::UpdateAncillaryBeams( float flConvergencePerc, const Vector &vecOrigin, const Vector &vecBasis )
{
	// Multiple beams deviate from the basis direction by a certain number of degrees and "converge" 
	// at the basis vector over a duration of time, the position in that duration expressed by 
	// flConvergencePerc.  The beams are most deviated at 0 and fully converged at 1.

	float flRotationOffset = (2*M_PI)/(float)NUM_ANCILLARY_BEAMS; // Degrees separating each beam, in radians
	float flDeviation = DEG2RAD(90) * ( 1.0f - flConvergencePerc );
	float flOffset;
	Vector vecFinal;
	Vector vecOffset;
	
	matrix3x4_t matRotate;
	QAngle vecAngles;
	VectorAngles( vecBasis, vecAngles );
	vecAngles[PITCH] += 90.0f;
	AngleMatrix( vecAngles, vecOrigin, matRotate );

	trace_t	tr;

	float flScale = LINE_LENGTH * flDeviation;

	// For each beam, find its offset and trace outwards to place its endpoint
	for ( int i = 0; i < NUM_ANCILLARY_BEAMS; i++ )
	{
		if ( flConvergencePerc >= 0.99f )
		{
			m_pAncillaryBeams[i]->TurnOn();
			continue;
		}

		m_pAncillaryBeams[i]->TurnOff();

		// Find the number of radians offset we are
		flOffset = (float) i * flRotationOffset + DEG2RAD( 30.0f );
		flOffset += (M_PI/8.0f) * sin( gpGlobals->curtime * 3.0f );
		
		// Construct a circle that's also offset by the line's length
		vecOffset.x = cos( flOffset ) * flScale;
		vecOffset.y = sin( flOffset ) * flScale;
		vecOffset.z = LINE_LENGTH;

		// Rotate this whole thing into the space of the basis vector
		VectorRotate( vecOffset, matRotate, vecFinal );
		VectorNormalize( vecFinal );

		// Trace a line down that vector to find where we'll eventually stop our line
		UTIL_TraceLine( vecOrigin, vecOrigin + ( vecFinal * LINE_LENGTH ), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );

		// Move the beam to that position
		m_pAncillaryBeams[i]->SetBrightness( static_cast<int>(255.0f * flConvergencePerc) );
		m_pAncillaryBeams[i]->SetEndPos( tr.startpos );
		m_pAncillaryBeams[i]->SetStartPos( tr.endpos );
	}
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:60,代码来源:npc_combine_cannon.cpp


示例20: AngleMatrix

//-----------------------------------------------------------------------------
// Purpose: Draw a circle whose center is at a position and is facing a specified direction
//-----------------------------------------------------------------------------
void NDebugOverlay::Circle( const Vector &position, const QAngle &angles, float radius, int r, int g, int b, int a, bool bNoDepthTest, float flDuration )
{
	// Setup our transform matrix
	matrix3x4_t xform;
	AngleMatrix( angles, position, xform );
	Vector xAxis, yAxis;
	// default draws circle in the y/z plane
	MatrixGetColumn( xform, 2, xAxis );
	MatrixGetColumn( xform, 1, yAxis );
	Circle( position, xAxis, yAxis, radius, r, g, b, a, bNoDepthTest, flDuration );
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:14,代码来源:debugoverlay_shared.cpp



注:本文中的AngleMatrix函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AngleMod函数代码示例发布时间:2022-05-30
下一篇:
C++ AngleDelta函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap