Legacy:Vehicles Pre2004/Driver - Unreal Wiki

# Legacy:Vehicles Pre2004/Driver

### From Unreal Wiki, The Unreal Engine Documentation Site

< Legacy:Vehicles Pre2004

I've added a driver to the speeder bike (I created a trike from it) this is how I’ve done it:

(this isn't all the code for the trike, because it's a little much to put it all here)

    class Trike extends KCar;

    var CarDummyDriver MyDummy;

    simulated function PostNetBeginPlay()

    {

            local vector RotX, RotY, RotZ;

            Super.PostNetBeginPlay();

            GetAxes(Rotation,RotX,RotY,RotZ);

            MyDummy = spawn(class'UMS_CarDummyDriver', self,, Location + DummyOffset.X * RotX + DummyOffset.Y * RotY + DummyOffset.Z * RotZ);

            MyDummy.SetBase(self);

            MyDummy.bHidden = True;

    }

    simulated function Destroyed()

    {

            Super.Destroyed();

            MyDummy.Destroy();

    }

    function KDriverEnter(Pawn p)

    {

            Super.KDriverEnter(p);

            p.bHidden = True;

            MyDummy.bHidden = False;

            MyDummy.LinkMesh(p.Mesh);

            MyDummy.Skins = p.Skins;

            //Set the rotation of bones, so it looks like it's sitting on the trike

            MyDummy.SetBoneRotation('bip01 spine', rot(0,8000,0));

            MyDummy.SetBoneRotation('Bip01 L UpperArm', rot(0,-14000,0));

            MyDummy.SetBoneRotation('Bip01 R UpperArm', rot(0,-14000,0));

    }

    function bool KDriverLeave(bool bForceLeave)

    {

            local Pawn OldDriver;

            OldDriver = Driver;

            // If we successfully got out of the car, make driver visible again.

            if( Super.KDriverLeave(bForceLeave) )

            {

                    MyDummy.bHidden = True;

                    return true;

            }

            else

                    return false;

    }

    defaultproperties

    {

            DummyOffset=(X=-26,Y=0,Z=10)

    }

And the dummy:

    class CarDummyDriver extends Actor;

    defaultproperties

    {

            Mesh=Mesh'Jugg.JuggMaleA'

            Skins(0)=Texture'PlayerSkins.JuggMaleABodyA'

            Skins(1)=Texture'PlayerSkins.JuggMaleAHeadA'

            bHardAttach=True

            DrawType=DT_Mesh

    }

##### Views

- Legacy
- Discussion
- Current revision

##### Search