RuneI
Class FootBridge

source: c:\runehov\RuneI\Classes\footbridge.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--RuneI.DecorationRune
            |
            +--RuneI.FootBridge
Direct Known Subclasses:None

class FootBridge
extends RuneI.DecorationRune

//============================================================================= // FootBridge. //=============================================================================

Function Summary
 void AddVelocity(vector NewVelocity)
 
simulated
FindAdjacents(int joint, out int, out int)
 
simulated
JointTouchedBy(Actor Other, int joint)



Source Code


00001	//=============================================================================
00002	// FootBridge.
00003	//=============================================================================
00004	class FootBridge extends DecorationRune;
00005	
00006	var(Sounds) Sound Creak;
00007	
00008	
00009	simulated event GetSpringJointParms(int joint, out float DampFactor, out float SpringConstant, out vector SpringThreshold)
00010	{
00011		DampFactor = 2;
00012		SpringConstant = 50;
00013		SpringThreshold = vect(15,15,100);
00014	}
00015	
00016	simulated function FindAdjacents(int joint, out int prev, out int next)
00017	{
00018		switch(joint)
00019		{
00020	//		case 3:		prev = 0;	next = 4;	break;
00021			case 4:		prev = 0;	next = 5;	break;
00022			case 5:		prev = 4;	next = 2;	break;
00023			case 2:		prev = 5;	next = 9;	break;
00024			case 9:		prev = 2;	next = 10;	break;
00025			case 10:	prev = 9;	next = 8;	break;
00026			case 8:		prev = 10;	next = 7;	break;
00027			case 7:		prev = 8;	next = 13;	break;
00028			case 13:	prev = 7;	next = 15;	break;
00029			case 15:	prev = 13;	next = 12;	break;
00030			case 12:	prev = 15;	next = 14;	break;
00031			case 14:	prev = 12;	next = 18;	break;
00032			case 18:	prev = 14;	next = 0;	break;
00033	//		case 17:	prev = 18;	next = 0;	break;
00034		}
00035	}
00036	
00037	function AddVelocity(vector NewVelocity)
00038	{	// Momentum has come in from another actor
00039	}
00040	
00041	simulated function JointTouchedBy(actor Other, int joint)
00042	{
00043		local vector vel,v;
00044		local int prev, next, dummy;
00045		local rotator torque;
00046	
00047		vel = Other.Velocity;
00048		if (VSize2D(vel) > 0 && vel.Z==0)
00049			vel.Z = -5;
00050		vel.X *= 0.05;
00051		vel.Y *= 0.05;
00052		vel.Z *= 0.5;
00053	
00054		ApplyJointForce(joint, vel);
00055	
00056		if (vel.Z < -5)
00057			PlaySound(Creak, SLOT_Misc,,,, FRand()*0.5 + 0.8);
00058	
00059		FindAdjacents(joint, prev, next);
00060	
00061		v = vel;
00062		while (prev != 0)
00063		{
00064			v *= 0.5;
00065			if (VSize(v) < 1)
00066				break;
00067	
00068			ApplyJointForce(prev, v);
00069			FindAdjacents(prev, prev, dummy);
00070		}
00071	
00072		v = vel;
00073		while (next != 0)
00074		{
00075			v *= 0.5;
00076			if (VSize(v) < 1)
00077				break;
00078	
00079			ApplyJointForce(next, v);
00080			FindAdjacents(next, dummy, next);
00081		}
00082	}
00083	
00084	defaultproperties
00085	{
00086	     Creak=Sound'FootstepsSnd.Bridge.footbridge01'
00087	     bStatic=False
00088	     DrawType=DT_SkeletalMesh
00089	     bComplexOcclusion=True
00090	     CollisionRadius=220.000000
00091	     bCollideActors=True
00092	     bBlockActors=True
00093	     bBlockPlayers=True
00094	     bJointsBlock=True
00095	     bJointsTouch=True
00096	     Mass=50.000000
00097	     Skeletal=SkelModel'objects.footbridge'
00098	}

End Source Code