RuneI
Class BoneBridgeSmall

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

class BoneBridgeSmall
extends RuneI.DecorationRune

//============================================================================= // BoneBridgeSmall. //=============================================================================

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



Source Code


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

End Source Code