## XIDCine
Class Movable

source: C:\XIII\XIDCine\Classes\Movable.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Mover
             |
             +--XIII.XIIIMover
                |
                +--XIII.XIIIMovable
                   |
                   +--XIDCine.Movable

Direct Known Subclasses:None

class Movable
extends XIII.XIIIMovable

    //-----------------------------------------------------------
    // Movable
    // Created by iKi on ??? ??th 2001
    // Last Modification Feb 27th 2002
    //-----------------------------------------------------------

Variables
`float` | `t`

Source Code

    00001	//-----------------------------------------------------------
    00002	// Movable
    00003	// Created by iKi on ??? ??th 2001
    00004	// Last Modification Feb 27th 2002
    00005	//-----------------------------------------------------------
    00006	class Movable extends XIIIMovable;
    00007
    00008	VAR float t;
    00009
    00010	AUTO STATE() MovableState
    00011	{
    00012		EVENT bool EncroachingOn( actor Other )
    00013		{
    00014			return false;
    00015		}
    00016
    00017		EVENT PostBeginPlay()
    00018		{
    00019			KeyNum=0;
    00020			t=0;
    00021		}
    00022
    00023		EVENT Tick(float dt)
    00024		{
    00025			velocity.y=1000;
    00026		}
    00027
    00028		EVENT Bump( actor Other )
    00029		{
    00030			LOCAL Vector v;
    00031			LOCAL Float PlayerAbscisse,s,d;
    00032
    00033			v=KeyPos[1]-KeyPos[0];
    00034			d=VSize(v);
    00035			s=3/VSize(KeyPos[1]-KeyPos[0]);
    00036
    00037			if (Pawn(Other).IsPlayerPawn())
    00038			{
    00039				SetPhysics(PHYS_Flying);
    00040
    00041				if (Other.base!=self && abs(Normal(Other.Location-Location)dot Normal(v))>0.7) // don't move if player is on us
    00042				{
    00043					PlayerAbscisse=((Other.location-BasePos)dot v)/(d*d);
    00044					t=((location-BasePos)dot v)/(d*d);
    00045					log("bump" @ t @ " , " @ PlayerAbscisse);
    00046					if (PlayerAbscisse<t)
    00047					{
    00048						t=FClamp(t+s,0,1);
    00049	//					velocity=Normal(v)*100;
    00050						SetLocation(BasePos+t*(KeyPos[1]-KeyPos[0]));
    00051	//					log("Avance "@t);
    00052					}
    00053					else
    00054					{
    00055						t=FClamp(t-s,0,1);
    00056						SetLocation(BasePos+t*(KeyPos[1]-KeyPos[0]));
    00057	//					log("Recule "@t);
    00058					}
    00059
    00060				}
    00061			}
    00062		}
    00063	/*
    00064		event KeyFrameReached()
    00065		{
    00066			local int NextKey;
    00067			if (KeyNum==NumKeys-1)
    00068				NextKey=0;
    00069			else
    00070				NextKey=KeyNum+1;
    00071			KeyRot[NextKey]-=KeyRot[KeyNum];
    00072			KeyRot[NextKey].Yaw=((KeyRot[NextKey].Yaw+32768)&65535)-32768;
    00073			KeyRot[NextKey].Roll=((KeyRot[NextKey].Roll+32768)&65535)-32768;
    00074			KeyRot[NextKey].Pitch=((KeyRot[NextKey].Pitch+32768)&65535)-32768;
    00075			KeyRot[NextKey]+=KeyRot[KeyNum];
    00076			InterpolateTo(NextKey,MoveTime);
    00077		}
    00078	Begin:
    00079	     DoOpen();
    00080	     FinishInterpolation();*/
    00081	}
    00082
    00083
    00084
    00085	defaultproperties
    00086	{
    00087	}

End Source Code