当前位置: 首页>>代码示例>>C++>>正文


C++ idAngles类代码示例

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


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

示例1: Event_AngToUp

/*
================
idThread::Event_AngToUp
================
*/
void idThread::Event_AngToUp( idAngles &ang )
{
    idVec3 vec;

    ang.ToVectors( NULL, NULL, &vec );
    ReturnVector( vec );
}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:12,代码来源:Script_Thread.cpp

示例2: Event_SetAngles

/*
================
sdClientScriptEntity::Event_SetAngles
================
*/
void sdClientScriptEntity::Event_SetAngles( const idAngles& ang ) {
	idMat3 axis = ang.ToMat3();

	SetAxis( axis );

	if ( GetPhysics() != NULL ) {
		GetPhysics()->SetAxis( axis );
	}
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例3: GetAngles

/*
================
idDict::GetAngles
================
*/
bool idDict::GetAngles( const char *key, const char *defaultString, idAngles &out ) const {
	bool		found;
	const char	*s;
	if( !defaultString ) {
		defaultString = "0 0 0";
	}
	found = GetString( key, defaultString, &s );
	out.Zero();
	sscanf( s, "%f %f %f", &out.pitch, &out.yaw, &out.roll );
	return found;
}
开发者ID:revelator,项目名称:Revelation,代码行数:16,代码来源:Dict.cpp

示例4: ShakeOffsets

// RAVEN BEGIN
// jnewquist: Controller rumble
void idPlayerView::ShakeOffsets( idVec3 &shakeOffset, idAngles &shakeAngleOffset, const idBounds bounds ) const {
	float shakeVolume = 0.0f;
	shakeOffset.Zero();
	shakeAngleOffset.Zero();

	if( gameLocal.isMultiplayer ) {
		return;
	}

	shakeVolume = CalculateShake( shakeAngleOffset );

	if( gameLocal.time < shakeFinishTime ) {
		float offset = ( shakeFinishTime - gameLocal.time ) * shakeScale * 0.001f;

		shakeOffset[0] = idMath::ClampFloat( bounds[0][0] - 1.0f, bounds[1][0] + 1.0f, rvRandom::flrand( -offset, offset ) );
		shakeOffset[1] = idMath::ClampFloat( bounds[0][1] - 1.0f, bounds[1][1] + 1.0f, rvRandom::flrand( -offset, offset ) );
		shakeOffset[2] = idMath::ClampFloat( bounds[0][2] - 1.0f, bounds[1][2] + 1.0f, rvRandom::flrand( -offset, offset ) );

		shakeAngleOffset[0] = idMath::ClampFloat( -70.0f, 70.0f, rvRandom::flrand( -offset, offset ) );
		shakeAngleOffset[1] = idMath::ClampFloat( -70.0f, 70.0f, rvRandom::flrand( -offset, offset ) );
		shakeAngleOffset[2] = idMath::ClampFloat( -70.0f, 70.0f, rvRandom::flrand( -offset, offset ) );
	}
}
开发者ID:AliKalkandelen,项目名称:quake4,代码行数:25,代码来源:PlayerView.cpp

示例5: MS2SEC

/*
================
sdDeliveryVehicle::Magog_DoMove
================
*/
void sdDeliveryVehicle::Magog_DoMove( const idVec3& aheadPointIdeal, const idVec3& aheadPointDir, const idVec3& endPoint, float itemRotation, float maxYawScale, bool orientToEnd, bool clampRoll, bool slowNearEnd, float pathSpeed ) {
	float frameTime = MS2SEC( gameLocal.msec );

	idVec3 aheadPoint = aheadPointIdeal;
	const idVec3& origin = GetPhysics()->GetOrigin();
	const idVec3& velocity = GetPhysics()->GetLinearVelocity();
	const idMat3& axis = GetPhysics()->GetAxis();
	const idAngles angles = axis.ToAngles();
	const idVec3& angVel = GetPhysics()->GetAngularVelocity();
	
	const idVec3& currentFwd = axis[ 0 ];
	const idVec3& currentRight = axis[ 1 ];
	const idVec3& currentUp = axis[ 2 ];
	
	float rollVel = angVel * currentFwd;
	float pitchVel = angVel * currentRight;
	float yawVel = angVel * currentUp;

	// find the current height of the vehicle
	idVec3 futureContribution = velocity * 1.0f;
	futureContribution.z = 0.0f;
	float futureContributionLength = futureContribution.Length();
	if ( futureContributionLength > 2000.0f ) {
		futureContribution = futureContribution * ( 2000.0f / futureContributionLength );
	}

	idVec3 futureSpot = origin + futureContribution;
	futureSpot.z -= HOVER_DOWNCAST_LENGTH;

	trace_t trace;
	gameLocal.clip.TraceBounds( CLIP_DEBUG_PARMS trace, origin, futureSpot, GetPhysics()->GetBounds(), axis, MASK_SOLID | MASK_OPAQUE, this );
	futureSpot = trace.endpos;

	// shift the ahead point based on the trace
	float currentHeight = origin.z - futureSpot.z;
	if ( currentHeight < HOVER_DOWNCAST_LENGTH ) { 
		aheadPoint.z = origin.z - currentHeight + HOVER_HEIGHT_AIM;
	} else {
		aheadPoint.z = origin.z - HOVER_DOWNCAST_LENGTH + HOVER_HEIGHT_AIM;
	}

//	sys.debugCircle( g_colorRed, origin, '0 0 1', 16, 8, 0 );
//	sys.debugArrow( g_colorRed, origin, futureSpot, 256, 0 );
//	sys.debugCircle( g_colorRed, futureSpot, '0 0 1', 16, 8, 0 );
//	sys.debugCircle( '0 1 0', aheadPoint, '0 0 1', 256.0f, 16, 0 );


	idVec3 point;
	float lookaheadFactor;

	{
		// generate a cubic spline between the two points
		idVec3 x0 = origin;
		idVec3 x1 = aheadPoint;
		idVec3 dx0 = velocity * 3.0f;					// maintaining our current velocity is more important
		idVec3 dx1 = aheadPointDir * pathSpeed * 1.0f;	// than matching the destination vector
		
		// calculate coefficients
		idVec3 D = x0;
		idVec3 C = dx0;
		idVec3 B = 3*x1 - dx1 - 2*C - 3*D;
		idVec3 A = x1 - B - C - D;
		
		float distanceLeft = ( endPoint - origin ).Length();
		lookaheadFactor = ( distanceLeft / 6096.0f ) * 0.5f;
		lookaheadFactor = idMath::ClampFloat( 0.2f, 0.5f, lookaheadFactor );
		if ( !slowNearEnd ) {
			lookaheadFactor = 0.5f;
		}
		
		point = ( A * lookaheadFactor + B )*lookaheadFactor*lookaheadFactor + C*lookaheadFactor + D;
	}


	//
	// Follower logic
	//
	idVec3 delta = point - origin;
	idVec3 aheadDelta = aheadPoint - origin;

	idVec3 newVelocity = vec3_origin;

	//
	// Z axis
	//

	// figure out what Z velocity is needed to get where we want to go within a frame
	float Zvel = aheadDelta.z / frameTime;
	Zvel = idMath::ClampFloat( -maxZVel, maxZVel, Zvel );
	
	// figure out what Z acceleration is neccessary
	float ZAccel = ( Zvel - velocity.z ) / frameTime;
	ZAccel = idMath::ClampFloat( -maxZAccel, maxZAccel, ZAccel );
	
	// chop the Z acceleration when its nearing the end - helps to avoid settling issues
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例6: Event_AngToForward

/*
================
idThread::Event_AngToForward
================
*/
void idThread::Event_AngToForward( idAngles &ang ) {
	ReturnVector( ang.ToForward() );
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例7: Event_SetJointAngle

/*
================
sdClientAnimated::Event_SetJointAngle
================
*/
void sdClientAnimated::Event_SetJointAngle( jointHandle_t joint, jointModTransform_t transformType, const idAngles& angles ) {
	animator.SetJointAxis( joint, transformType, angles.ToMat3() );
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: UpdateViewAngles

/*
================
hhCameraInterpolator::UpdateViewAngles
================
*/
idAngles hhCameraInterpolator::UpdateViewAngles( const idAngles& viewAngles ) {
	return (viewAngles.ToMat3() * GetCurrentAxis()).ToAngles();
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:8,代码来源:prey_camerainterpolator.cpp


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