| Home Page | Recent Changes

Vehicles/Driver

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
}

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In