I ported over the pylon (a traffic cone) decoration from UT - and with some minimal changes, it works when hit by pawns or weapon fire and the karma collision of vehicles, but it doesn't collide with the vehicles wheels.
Should I instead make the cone as a Karma object, or would that be too laggy (my reason for using the UT pylon code, was that it'd be less taxing that Karma on processing time)
Should I instead make the cone as a Karma object, or would that be too laggy (my reason for using the UT pylon code, was that it'd be less taxing that Karma on processing time)
Code:
//-----------------------------------------------------------
// Bouncy Cone!
//-----------------------------------------------------------
class J6ConeDeco extends decoration;
var bool bFirstHit;
function Attach( Actor Other )
{
Velocity.X = 0;
Velocity.Y = 0;
Velocity.Z = FMin(0, Velocity.Z);
}
function Timer()
{
SetCollision(true,true,true);
}
function Bump( actor Other )
{
Velocity += 1.5 * VSize(Other.Velocity) * Normal(Location - Other.Location);
if ( Physics == PHYS_None )
Velocity.Z = FMax(Velocity.Z,250);
SetPhysics(PHYS_Falling);
SetTimer(0.3,False);
Instigator = Pawn(Other);
SetCollision(true,false,false);
StartRotating();
}
function StartRotating()
{
RotationRate.Yaw = 250000*FRand() - 125000;
RotationRate.Pitch = 250000*FRand() - 125000;
RotationRate.Roll = 250000*FRand() - 125000;
DesiredRotation = RotRand();
bRotateToDesired=False;
bFixedRotationDir=True;
bFirstHit=True;
}
function Landed(vector HitNormal)
{
local Rotator NewRot;
Super.Landed(HitNormal);
NewRot = Rotation;
NewRot.Pitch = 18768;
SetRotation(NewRot);
}
Auto State Animate
{
function BeginState()
{
super.BeginState();
SetCollision(true,true,true);
NetUpdateTime = Level.TimeSeconds - 1;
}
function HitWall (vector HitNormal, actor Wall)
{
local float speed;
Velocity = 0.5*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity); // Reflect off Wall w/damping
speed = VSize(Velocity);
if (bFirstHit && speed<400)
{
bFirstHit=False;
bRotatetoDesired=True;
bFixedRotationDir=False;
DesiredRotation.Yaw=Rand(65535);
DesiredRotation.Pitch=Rand(65535);
DesiredRotation.Roll=0;
}
RotationRate.Yaw = RotationRate.Yaw*0.75;
RotationRate.Roll = RotationRate.Roll*0.75;
RotationRate.Pitch = RotationRate.Pitch*0.75;
If (speed < 50)
{
bBounce = False;
DesiredRotation.Yaw = Rotation.Yaw;
DesiredRotation.Roll = Rotation.Roll;
DesiredRotation.Pitch=18768;
SetRotation(DesiredRotation);
}
}
function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType)
{
SetPhysics(PHYS_Falling);
bBounce = True;
Velocity += Momentum/Mass;
Velocity.Z = FMax(Momentum.Z, 200);
StartRotating();
}
}
//=============================================================================
// defaultproperties
//=============================================================================
defaultproperties
{
DrawType=DT_StaticMesh
bStatic=false
bStasis=false
bDamageable=false
bCanBeDamaged=false
bEdShouldSnap=true
bUseCylinderCollision=true
bCollideActors=true
bCollideWorld=true
bBlockActors=true
bBlockKarma=true
bFixedRotationDir=true
bOrientOnSlope=false
bPushable=true
bMovable=true
SurfaceType=EST_Glass
CollisionRadius=24.000000
CollisionHeight=4.000000
bProjTarget=True
bAutoAlignToTerrain=True
bNetInitialRotation=true
RemoteRole=ROLE_SimulatedProxy
bNetNotify=true
CullDistance=2500
NetUpdateFrequency=1
StaticMesh=StaticMesh'BulldogJ6.J6ConeTest'
Skins(0)=Shader'BulldogJ6.Shaders.J6TestCone'
Skins(1)=Shader'BulldogJ6.Shaders.J6TestCone'
}