Hey,
I wrote a simple pawn class that uses this material so you can free up your Kismet a bit. The trick was to create a MaterialInstance in the UDK editor first, then reference it in UnrealScript.
I used this exact Material setup, but I changed the X/Y/Z ScalarParameter names to XPos, YPos, and ZPos.
Here's the code for the Pawn, but you could just as easily put this in the PlayerController class with a couple simple edits. You can see the material is located at "MyPackage.material.mat_test_worldpos_INST" - MyPackage is the package, Material is the group, and Mat_Test_WorldPos_INST is the MaterialInstanceName.
Here's what it looks like on a pawn:

And here's the code:
Code:
class WorldPawn extends UTPawn;
var MaterialInstanceConstant WorldPos;
function Tick( float DeltaTime )
{
local float X;
local float Y;
local float Z;
X = Location.X;
Y = Location.Y;
Z = Location.Z;
super.Tick(DeltaTime);
WorldPos.SetScalarParameterValue('Radius', 50);
WorldPos.SetScalarParameterValue('XPos', X);
WorldPos.SetScalarParameterValue('YPos', Y);
WorldPos.SetScalarParameterValue('ZPos', Z);
}
defaultproperties
{
WorldPos=MaterialInstanceConstant'MyPackage.material.mat_test_worldpos_INST'
Name="Default__WorldPawn"
}
Thanks, Ozz.
Bookmarks