UE3 - UDK Moving Locked crosshair to a different default location

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Sicundercover

New Member
Jan 8, 2013
3
0
0
Im pretty new to UDK and unreal script in general.

Ive gotten my camera where I want it but its location causes my shots to land just low and to the left of the crosshair. What I am trying to figure out is whether the crosshair is locked in position on one of the .ini files or if its in some Scaleform package I cant alter? Will I have to build a new UI with a new crosshair or is there a file I can alter to change its default location?

Also I have created a few new classes to get the camera to behave the way I want it to, could I just add a few varibles to re-position the crosshair or is it not something that can be controlled by the script?
 
Last edited:

Sicundercover

New Member
Jan 8, 2013
3
0
0
So with the scanning through the classes Ive done it appears that the locked coordinate are in this line of code,

Code:
simulated function DrawLockedOn( HUD H )
{
    local vector2d CrosshairSize;
    local float x, y, ScreenX, ScreenY, LockedOnTime, TargetDist;

    TargetDist = GetTargetDistance();

    if ( !bWasLocked )
    {
        LockedStartTime = WorldInfo.TimeSeconds;
        CurrentLockedScale = StartLockedScale;
        bWasLocked = true;
    }
    else
    {
        LockedOnTime = WorldInfo.TimeSeconds - LockedStartTime;
        CurrentLockedScale = (LockedOnTime > LockedScaleTime) ? FinalLockedScale : (StartLockedScale * (LockedScaleTime - LockedOnTime) + FinalLockedScale * LockedOnTime)/LockedScaleTime;
    }
    CrosshairSize.Y = UTHUDBase(H).ConfiguredCrosshairScaling * CurrentLockedScale * CrosshairScaling * LockedCrossHairCoordinates.VL * H.Canvas.ClipY/720;
    CrosshairSize.X = CrosshairSize.Y * ( LockedCrossHairCoordinates.UL / LockedCrossHairCoordinates.VL );

    X = H.Canvas.ClipX * 0.5;
    Y = H.Canvas.ClipY * 0.5;
    ScreenX = X - (CrosshairSize.X * 0.5);
    ScreenY = Y - (CrosshairSize.Y * 0.5);
    if ( CrosshairImage != none )
    {
        // crosshair drop shadow
        H.Canvas.DrawColor = class'UTHUD'.default.BlackColor;
        H.Canvas.SetPos( ScreenX+1, ScreenY+1, TargetDist );
        H.Canvas.DrawTile(CrosshairImage,CrosshairSize.X, CrosshairSize.Y, LockedCrossHairCoordinates.U, LockedCrossHairCoordinates.V, LockedCrossHairCoordinates.UL,LockedCrossHairCoordinates.VL);

        H.Canvas.DrawColor = CrosshairColor;
        H.Canvas.SetPos(ScreenX, ScreenY, TargetDist);
        H.Canvas.DrawTile(CrosshairImage,CrosshairSize.X, CrosshairSize.Y, LockedCrossHairCoordinates.U, LockedCrossHairCoordinates.V, LockedCrossHairCoordinates.UL,LockedCrossHairCoordinates.VL);
    }
}

But most importantly it seems to be in this bit of code,

X = H.Canvas.ClipX * 0.5;
Y = H.Canvas.ClipY * 0.5;
ScreenX = X - (CrosshairSize.X * 0.5);
ScreenY = Y - (CrosshairSize.Y * 0.5);

It looks as if it is centering x and y by dividing the screen into two halves while then subtracting 0.5 more from each to center a image.

Currently Im trying to figure a way to to alter this without altering the original UTWeapon class. I was wondering if I could create a new class that extends UTWeapon since UTWeapon is an extension of UDKWeapon?