Wikis / Unreal Wiki / Legacy:Mod Ideas/DevTools

This is a growing collection of my own tools used to aid development of mods.

Current Features

  • Shows the display debug for any pawn if the crosshair is on top of it

Pieces Of Code

Display Debug fix!

In my Interaction class:

function PostRender( canvas Canvas )
{
	local Actor p;
	local float a, b;
	local vector HitLocation, HitNormal;
 
	a = Canvas.CurYL;
	b = 0;
 
	mainTrace(HitLocation, HitNormal, p, 2048);
 
	if(Pawn(p) != none)
	{
	    p.DisplayDebug(Canvas, a, b);
	}
}

MainTrace():

(obviously it is declared inside the Interaction class)

// ===========================================================================
// mainTrace
//
// This function traces for known actors that are RIGHT in front of the camera (under the crosshair)
// ===========================================================================
function mainTrace(out vector HitLocation, out vector HitNormal, out Actor aThing, float fDistance)
{
	local vector StartTrace, EndTrace;
	local PlayerController PlayerOwner;
 
	// Log(self$": before assigning the playerOwner"); //DEBUG
	PlayerOwner = ViewportOwner.Actor;
	// Log(self$": after assigning the playerOwner"); //DEBUG
 
	// important: find the REAL rotation of the camera - X and Y
 
	// Log(self$": before trace"); // DEBUG
	// Perform a trace to find any colliding actors
	StartTrace = PlayerOwner.Pawn.Location;			// the beginning of the trace
	StartTrace.Z += PlayerOwner.Pawn.BaseEyeHeight;	// account for player's eye height
	// I call this the oblivion vector
	EndTrace = StartTrace + vector(PlayerOwner.Pawn.GetViewRotation()) * fDistance;
	// TODO: try fasttrace
	aThing = PlayerOwner.Pawn.Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);
}

Suggestions

Please feel free to suggest any other features that could be included in this mod. Just try to stick to mutator functionality, so that it can be tested with other game types!


DevTools

by AlphaOne


Discussion

Foxpaw: Is the mainTrace function a function you wrote yourself or is it included in the base UT2003 packages. I've never seen it called elsewhere.

AlphaOne: Oops! Forgot to mention that Yes it is one of my own.

Daemonica: I noticed the Todo line, I wouldn't try as FastTrace will only return a True/False if the trace hits World Geometry. On a side note I'm trying to implement a similar function within a PlayerController class and having little to no success, even though the code is the same ;)

Info Page Information

2022-11-18T10:00:29.198473Z 2003-11-24T16:47:12Z Pat611.ccs.yorku.ca * https://wiki.beyondunreal.com/Legacy:Mod Ideas/DevTools Attribution-NonCommercial-ShareAlike 3.0