Ejemplo n.º 1
0
main()
{
	int FixtureIndex;
	double NewOriginOffset,OriginOffsetY,AxisOffsetY;
	double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;

	GetFixtureIndex(&FixtureIndex);

	GetOriginOffset(&OriginOffsetY, FixtureIndex, Yaxis);

	GetAxisOffset(&AxisOffsetY, Yaxis);
	
	GetMachine(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec);

	// Compute Origin Offset to make DRO zero
	//
	// Since Machine = DRO + OriginOffset + AxisOffset
	//
	// Set DRO = 0 and solve for OriginOffset
	//
	NewOriginOffset = Machiney -  AxisOffsetY;
	SetUserDataDouble(TMP,NewOriginOffset);
	SetVars(5201+FixtureIndex*20+1, 1, TMP);

	DoPC(PC_COMM_UPDATE_FIXTURE);
}
Ejemplo n.º 2
0
main()
{
	int FixtureIndex;
	double NewOriginOffset,OriginOffsetX,AxisOffsetX;
	double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;

	GetFixtureIndex(&FixtureIndex);

	GetOriginOffset(&OriginOffsetX, FixtureIndex, Xaxis);

	GetAxisOffset(&AxisOffsetX, Xaxis);
	
	GetMachine(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec);

	// Compute Origin Offset to make DRO zero
	//
	// Since Machine = DRO + OriginOffset + AxisOffset
	//
	// Set DRO = 0 and solve for OriginOffset
	//
	NewOriginOffset = Machinex -  AxisOffsetX;

	pD[TMP]=NewOriginOffset;
	SetVars(5201+FixtureIndex*20+0, 1, TMP);

	DoPC(PC_COMM_UPDATE_FIXTURE);
}
Ejemplo n.º 3
0
/*
================
idPhysics_Parametric::Evaluate
================
*/
bool idPhysics_Parametric::Evaluate( int timeStepMSec, int endTimeMSec ) {
	idVec3 oldLocalOrigin, oldOrigin, masterOrigin;
	idAngles oldLocalAngles, oldAngles;
	idMat3 oldAxis, masterAxis;

	isBlocked = false;
	oldLocalOrigin = current.localOrigin;
	oldOrigin = current.origin;
	oldLocalAngles = current.localAngles;
	oldAngles = current.angles;
	oldAxis = current.axis;

	current.localOrigin.Zero();
	current.localAngles.Zero();

	if ( current.spline != NULL ) {
		float length = current.splineInterpolate.GetCurrentValue( endTimeMSec );
		float t = current.spline->GetTimeForLength( length, 0.01f );
		current.localOrigin = current.spline->GetCurrentValue( t );
		if ( current.useSplineAngles ) {
			current.localAngles = current.spline->GetCurrentFirstDerivative( t ).ToAngles();
		}
	} else if ( current.linearInterpolation.GetDuration() != 0 ) {
		current.localOrigin += current.linearInterpolation.GetCurrentValue( endTimeMSec );
	} else {
		current.localOrigin += current.linearExtrapolation.GetCurrentValue( endTimeMSec );
	}

	if ( current.angularInterpolation.GetDuration() != 0 ) {
		current.localAngles += current.angularInterpolation.GetCurrentValue( endTimeMSec );
	} else {
		current.localAngles += current.angularExtrapolation.GetCurrentValue( endTimeMSec );
	}

	current.localAngles.Normalize360();
	current.origin = current.localOrigin;
	current.angles = current.localAngles;
	current.axis = current.localAngles.ToMat3();

	if ( hasMaster ) {
		self->GetMasterPosition( masterOrigin, masterAxis );
		if ( masterAxis.IsRotated() ) {
			current.origin = current.origin * masterAxis + masterOrigin;
			if ( isOrientated ) {
				current.axis *= masterAxis;
				current.angles = current.axis.ToAngles();
			}
		}
		else {
			current.origin += masterOrigin;
		}
	}

	if ( isPusher ) {

		gameLocal.push.ClipPush( pushResults, self, pushFlags, oldOrigin, oldAxis, current.origin, current.axis );
		if ( pushResults.fraction < 1.0f ) {
// RAVEN BEGIN
// ddynerman: multiple clip worlds
			clipModel->Link( self, 0, oldOrigin, oldAxis );
// RAVEN END
			current.localOrigin = oldLocalOrigin;
			current.origin = oldOrigin;
			current.localAngles = oldLocalAngles;
			current.angles = oldAngles;
			current.axis = oldAxis;
			isBlocked = true;
			return false;
		}

		current.angles = current.axis.ToAngles();
	}

	if ( clipModel ) {
// RAVEN BEGIN
// abahr: a hack way of hiding gimble lock from movers.
		clipModel->Link( self, 0, current.origin, UseAxisOffset() ? GetAxisOffset() * current.axis : current.axis );
// RAVEN END
	}

	current.time = endTimeMSec;

	if ( TestIfAtRest() ) {
		Rest();
	}

	return ( current.origin != oldOrigin || current.axis != oldAxis );
}