UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 4

97

Adding a base mesh to a pickup is a great way to emphasize that a particular pickup
is important. By adding a base mesh, our pickup is no longer floating from thin air,
but actually appears to spawn from a device of some sort.


We may want a weapon or a power-up, such as quad damage to be highlighted on
the level, so we'll add a static mesh beneath it.


Getting ready


Open up our Tut_AmmoPickup class in your IDE and we'll begin to make those changes.


How to do it...


Once again we will need to start by making changes within our defaultproperties block,
as that is where most of our pickup's functionality can be adjusted easily:



  1. At the bottom of your class, inside of your defaultproperties block, add the
    following code:
    defaultproperties
    {
    ......
    /* Name of the base mesh that sits beneath our pickup /
    Begin Object Name=BaseMeshComp
    StaticMesh=StaticMesh'Pickups.
    Health_Large.Mesh.S_Pickups_Base_Health_Large'


/** We want to drop it down a bit beneath the pickup to
allow for a particle to rest between the pickup and the
base */
Translation=(Z=-44)
Scale=.8
End Object
......
}

We've just added a base mesh to sit beneath our pickup. The reason we translate
on the z axis is because we want to have some room to add a particle effect in our
next step, otherwise our base would look kind of bland. We also scale it to 0.8, as
otherwise there would be a slight offset applied to the base mesh. You could have
the base mesh at full size, but you would need to translate on the x axis to
compensate for the offset.
Free download pdf