For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

How can I draw a crosshair that projects itself infront of a player with a minimal amount of code?

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
スマイル・ドラゴン
OldUnreal Member
Posts: 1263
Joined: Sun Feb 10, 2008 9:07 pm

How can I draw a crosshair that projects itself infront of a player with a minimal amount of code?

Post by スマイル・ドラゴン »

I'm working on a project that mimics the gameplay of Hotline Miami in Unreal and I need a way to draw the 2D crosshair infront of a players general direction and dolly around them as they turn accordingly without too complicated scripting, is there a way I can do this without resorting to WorldToScreen methods?

For reference the ViewPort's Camera is pitched exactly -16834 and the Camera has a Z of 384.0 units above the Location of the PlayerPawn.
“I am the dragon without a name.”
Ðàrk-_¦_-Ñïght.: / κυνικός Δράκων / スマイル・ドラゴン / Draco Nihil
User avatar
Buffalo Baggins
OldUnreal Member
Posts: 21
Joined: Mon Dec 12, 2016 2:08 am

Re: How can I draw a crosshair that projects itself infront of a player with a minimal amount of code?

Post by Buffalo Baggins »

I don't know how to do this, but let me just say
I support your efforts wholly
America is a tune. It must be sung together.
User avatar
Bleeder91[NL]
OldUnreal Member
Posts: 1062
Joined: Sun Oct 04, 2009 7:22 pm

Re: How can I draw a crosshair that projects itself infront of a player with a minimal amount of code?

Post by Bleeder91[NL] »

I was bored, so in case you still needed this:

Code: Select all

local vector Offset; // The offset from the center of the screen.
local float OffsetDist; // Distance from the edge of the screen (0-1).

Offset.X=FMin(Canvas.ClipX,Canvas.ClipY)*0.5*OffsetDist;
Offset=Offset>>Pawn(Owner).ViewRotation.Yaw*rot(0,1,0);

Canvas.SetPos(C.ClipX/2-Offset.Y-8, C.ClipY/2+Offset.X-8);
Canvas.DrawIcon(Texture'Crosshair1',1.0);
Might need some adjusting.
Image

Return to “UScript Board”