Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

ROEngine.ROBallisticProjectile


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
//=============================================================================
// ROBallisticProjectile
//=============================================================================
// Projectiles that do true ballistics calculations. Calculations
// are done in native code for this class and its subclasses when
// the physics are set to PHYS_Projectile
//=============================================================================
// Red Orchestra Source
// Copyright (C) 2005 John Gibson
//=============================================================================

class ROBallisticProjectile extends Projectile
	abstract
	native;

//=============================================================================
// Variables
//=============================================================================

var float	AmbientVolumeScale; // Amount to scale this projectiles ambient sound

// Constants
const 		ScaleFactor = 18.4;						// 18.4 unreal units = 1 foot in our game.
const 		ScaleFactorInverse = 0.0543;            // 1/Scalefactor

// Behavior
var()		float				BallisticCoefficient;	// Ballistic coefficient for this bullet
var			float				BCInverse;

// Debug
var 		bool 				bDebugBallistics;       // Set to true to turn on ballistics debugging
var			float				FlightTime;
var			Vector				OrigLoc;
var			Vector				TraceHitLoc;

var			bool				bTrueBallistics;		// If this is true do the true ballistics calcs in native, instead of standard projectile calcs
var 		bool				bInitialAcceleration;	// If this is true and bTrueBallistics is true, the projectile will accellerate to full speed over .1 seconds. This prevents the problem where a just spawned projectile passes right through something without colliding
var()		float				SpeedFudgeScale;        // Scales the velocity by this amount. Used to keep the proper ballistic trajectory while making the projectile phyically move slower
var()		float				MinFudgeScale; 			// When bInitalAcceleration and bTrueBallistics are true, the projectile will accellerate from MinFudgeScale up to SpeedFudgeScale over InitialAccelerationTime seconds
var()		float				InitialAccelerationTime;// Time in seconds it takes for the shell to get up to the full SpeedFudgeScale
//=============================================================================
// Functions
//=============================================================================

//-----------------------------------------------------------------------------
// PostBeginPlay
//-----------------------------------------------------------------------------

simulated function PostBeginPlay()
{
	local Vector	HitNormal;
	local Actor TraceHitActor;

	Velocity = Vector(Rotation) * Speed;
	BCInverse = 1 / BallisticCoefficient;

	if (Role == ROLE_Authority && Instigator != none && Instigator.HeadVolume.bWaterVolume)
		Velocity *= 0.5;

	if (bDebugBallistics)
	{
		FlightTime = 0;
		OrigLoc = Location;

		TraceHitActor = Trace(TraceHitLoc, HitNormal, Location + 65355 * Vector(Rotation), Location + (Instigator.CollisionRadius + 5) * vector(Rotation), true);

		if( TraceHitActor.IsA('ROBulletWhipAttachment'))
		{
			  TraceHitActor = Trace(TraceHitLoc, HitNormal, Location + 65355 * Vector(Rotation), TraceHitLoc + 5 * Vector(Rotation), true);
		}
				// super slow debugging
     	//Spawn(class 'RODebugTracerGreen',self,,TraceHitLoc,Rotation);
     	log("Debug Tracing TraceHitActor ="$TraceHitActor);
	}
}

simulated function HitWall(vector HitNormal, actor Wall)
{

	if (bDebugBallistics)
	{
		log("BulletImpactVel = "$VSize(Velocity) / ScaleFactor$" BulletDist = "$(VSize(Location - OrigLoc) / 60.352)$" BulletDrop = "$(((TraceHitLoc.Z - Location.Z) / ScaleFactor) * 12));

		if (Level.NetMode != NM_DedicatedServer)
			Spawn(class 'RODebugTracer',self,,Location,Rotation);

//		ROPawn(Instigator).BulletImpactVel = VSize(Velocity) / ScaleFactor;
//		ROPawn(Instigator).BulletFlightTime = FlightTime;
//		ROPawn(Instigator).BulletDist = VSize(Location - OrigLoc) / ScaleFactor;
//		ROPawn(Instigator).BulletRefDist = VSize(TraceHitLoc - OrigLoc) / ScaleFactor;
//		ROPawn(Instigator).BulletDrop = ((TraceHitLoc.Z - Location.Z) / ScaleFactor) * 12;
	}

}

defaultproperties
{
     AmbientVolumeScale=1.000000
     BallisticCoefficient=0.300000
     bTrueBallistics=True
     bInitialAcceleration=True
     SpeedFudgeScale=1.000000
     MinFudgeScale=0.025000
     InitialAccelerationTime=0.100000
     TossZ=0.000000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:28.000 - Creation time: Fri 13-10-2023 03:19:06.609 - Created with UnCodeX