About vector math


DrawDebugCoordinateSystem(  pawn.location ,  pawn.rotation , 50.0f, TRUE );
DrawDebugSphere (   pawn.location + (22 * Vector(pawn.rotation)  )    , 2, 10, 255, 255, 255, true);

The code shows a pawn’s coordinate system, and a white sphere on the red axis.
But I need the white sphere to be drawn on the green axis.

Could somebody please show me how to get it?

Another way to express what I am trying to do…

If I attach 2 sockets (the red ones) to the left, right hip of the pawn; I can get their locations by using GetSocketWorldLocationAndRotation().
But in my case, there is no socket at all, so how do I get those locations? (pawn always facing red axis).

Purpose: To do a trace() but not from the center of the pawn (pawn.location). I want to start a trace() a little bit offset to the left or to the right from the center of the pawn. The desired locations to do the trace() are at the assumed red sockets (the left or right side of the hip).

local rotator OffsetRot;

DrawDebugSphere (   pawn.location + (22 * Vector(OffsetRot)  )    , 2, 10, 255, 255, 255, true);

Should do it. Swap the + for a - if it’s not oriented correctly.

UnrealScript Expressions & Operators
Using Rotators in UnrealScript

UObject is your friend:

native(229) static final function			GetAxes( rotator A, out vector X, out vector Y, out vector Z );

local vector X, Y, Z;

GetAxes(Pawn.Rotation, X, Y, Z);

DrawDebugSphere(Pawn.Location + (22 * X), 2, 10, 255, 0, 0, true);
DrawDebugSphere(Pawn.Location + (22 * Y), 2, 10, 0, 255, 0, true);
DrawDebugSphere(Pawn.Location + (22 * Z), 2, 10, 0, 0, 255, true);

Thank you both for your help. :cool: