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

Onslaught.ONSImpactSparks


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
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
class ONSImpactSparks extends Emitter
	native;

#exec OBJ LOAD FILE=..\Textures\AW-2004Particles.utx
#exec OBJ LOAD FILE=..\Sounds\ONSVehicleSounds-S.uax

var() float			HorizontalVelocityRange;
var() float			AdditionalVelocityScale;
var() float			MaxAdditionalVelocity;
var() float			SparkRadiusScale;
var() interpcurve	SparkRate; // function of sliding velocity magnitude.

var() sound			ScrapeSound;

var	  bool			bSparksActive;

simulated event UpdateSparks(float SparkRadius, vector VehicleVelocity)
{
	local float UseRadius, VelMag, ParticleRate;
	local vector LocalVehVel, AddVel;

	// Use function to figure out how many particles we should be spewing.
	VelMag = VSize(VehicleVelocity);
	ParticleRate = InterpCurveEval(SparkRate, VelMag);

	if(ParticleRate > 0.001)
	{
		// Transform velocity into particle system space and project into contact plane.
		LocalVehVel = (VehicleVelocity << Rotation);
		LocalVehVel.X = 0;

		// If sparks are just turning on, set OldLocation to current Location to avoid spawn interpolation.
		if(!bSparksActive)
			OldLocation = Location;

		bSparksActive = true;

		UseRadius = SparkRadiusScale * SparkRadius;

		Emitters[0].ParticlesPerSecond = ParticleRate;
		Emitters[0].InitialParticlesPerSecond = ParticleRate;
		Emitters[0].AllParticlesDead = false;

		Emitters[0].StartLocationRange.Y.Min = -UseRadius;
		Emitters[0].StartLocationRange.Y.Max = UseRadius;

		Emitters[0].StartLocationRange.Z.Min = -UseRadius;
		Emitters[0].StartLocationRange.Z.Max = UseRadius;

		// Add velocity of vehicle to sparks.

		AddVel = AdditionalVelocityScale * LocalVehVel;
		if( VSize(AddVel) > MaxAdditionalVelocity )
		{
			AddVel = normal(AddVel) * MaxAdditionalVelocity;
		}

		Emitters[0].StartVelocityRange.Y.Min = (LocalVehVel.Y + AddVel.Y) - HorizontalVelocityRange;
		Emitters[0].StartVelocityRange.Y.Max = (LocalVehVel.Y + AddVel.Y) + HorizontalVelocityRange;

		Emitters[0].StartVelocityRange.Z.Min = (LocalVehVel.Z + AddVel.Z) - HorizontalVelocityRange;
		Emitters[0].StartVelocityRange.Z.Max = (LocalVehVel.Z + AddVel.Z) + HorizontalVelocityRange;

		AmbientSound = ScrapeSound;
	}
	else
	{
		bSparksActive = false;

		Emitters[0].ParticlesPerSecond = 0;
		Emitters[0].InitialParticlesPerSecond = 0;

		AmbientSound = None;
	}
}

defaultproperties
{
	bNoDelete=false
	bBlockActors=False
	RemoteRole=ROLE_None
	Physics=PHYS_None

	HorizontalVelocityRange=500
	AdditionalVelocityScale=0.25
	MaxAdditionalVelocity=200
	SparkRadiusScale=0.05
	SparkRate=(Points=((InVal=0,OutVal=0),(InVal=350,OutVal=0),(InVal=1200,OutVal=600),(InVal=100000,OutVal=600)))

	ScrapeSound=sound'ONSVehicleSounds-S.CollisionSounds.MetalScrape03'
	SoundVolume=80
	SoundRadius=64

	Begin Object Class=SpriteEmitter Name=SpriteEmitter0
		UseDirectionAs=PTDU_Up
		UseCollision=False
		UseColorScale=True
		UseSizeScale=True
		UseRegularSizeScale=False
		UniformSize=True
		ScaleSizeYByVelocity=True
		AutomaticInitialSpawning=False
		AddVelocityFromOwner=False
		Acceleration=(Z=-600.000000)
		DampingFactorRange=(X=(Min=0.500000,Max=0.500000),Y=(Min=0.500000,Max=0.500000),Z=(Min=0.100000,Max=0.100000))
		StartLocationRange=(X=(Min=-10.00000,Max=10.00000),Y=(Min=0.00000,Max=0.00000),Z=(Min=0.00000,Max=0.00000))
		ColorScale(0)=(Color=(B=174,G=255,R=255))
		ColorScale(1)=(RelativeTime=0.500000,Color=(B=49,G=214,R=242))
		ColorScale(2)=(RelativeTime=1.000000,Color=(G=40,R=102))
		MaxParticles=1000
		UseRotationFrom=PTRS_Actor
		SizeScale(1)=(RelativeTime=0.050000)
		SizeScale(2)=(RelativeTime=0.100000,RelativeSize=2.000000)
		SizeScale(3)=(RelativeTime=1.00000,RelativeSize=2.000000)
		StartSizeRange=(X=(Min=2.000000,Max=4.000000),Y=(Min=2.000000,Max=2.000000),Z=(Min=100.000000,Max=100.000000))
		ScaleSizeByVelocityMultiplier=(X=0.010000,Y=0.003000,Z=1.000)
		ScaleSizeByVelocityMax=1000
		VelocityLossRange=(X=(Min=1.0000000,Max=2.000000),Y=(Min=1.0000000,Max=2.000000),Z=(Min=1.0000000,Max=2.000000))
		MaxAbsVelocity=(X=1000,Y=1000,Z=1000);
		Texture=Texture'AW-2004Particles.Energy.SparkHead'
		LifetimeRange=(Min=0.400000,Max=0.600000)
		StartVelocityRange=(X=(Min=350.000000,Max=500.000000),Y=(Min=-50.000000,Max=50.000000),Z=(Min=-50.000000,Max=50.000000))
		RespawnDeadParticles=False
		ParticlesPerSecond=0.0
		InitialParticlesPerSecond=0.0
		Name="SpriteEmitter0"
	End Object
	Emitters(0)=SpriteEmitter'SpriteEmitter0'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:31:48.000 - Creation time: Do 14.8.2014 09:58:46.603 - Created with UnCodeX