Crosshair and player turning

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Crosshair and player turning

Re: Crosshair and player turning

by Matt » Mon May 21, 2018 5:54 pm

Oh, right, you want to do it through an overlay.

I'd really rather not touch those since I have no idea how the various types of offsets interact...

Re: Crosshair and player turning

by Apeirogon » Sat May 19, 2018 1:54 pm

from check pitch

// The player's view pitch is clamped between -32 and +56 degrees,
// which translates to about half a screen height up and (more than)
// one full screen height down from straight ahead when view panning
// is used.
What?
positions of cursor
You mean ui process event? Or input process?

And why I must use status bar, if there are render overlay?
Or just even create dumy actor with crosshair spite, which float around player.

Re: Crosshair and player turning

by Matt » Fri May 18, 2018 4:52 pm

The term I think is "aiming dead zone".

It can be done, but it does mess with player movement prediction so it might not look good in multiplayer.


First, you need to study MovePlayer() and CheckPitch() to figure out what you need to replace.

(basically you need to modify them so they only turn the player after a certain threshold, but still receive input for turning)

Then you need to replace the player pawn to add variables storing the position of the cursor.

Then you need to replace the status bar, and have the crosshair be drawn where the cursor should be. (I don't know how to draw the crosshair; worst case senario you can just draw your own cursor image)

Re: Crosshair and player turning

by Apeirogon » Fri May 18, 2018 12:11 pm

I found video, but as I said, its on acs.
https://www.youtube.com/watch?v=ZB3Gj7CGjF8

Crosshair and player turning

by Apeirogon » Mon May 07, 2018 5:14 am

How make crosshair move in some area on screen, if player move mouse, before actualy turn player?

If I badly explained what I want, heres a picture.
HRODA6A4.gif
Crosshair should be inside red circle(maybe not so large) all time, and must move freely inside this circle. Crosshair still constrolled by mouse/joystick "mushroom"/touchpad/etc.
Optionaly, change direction of shoot bullets, so they fly in direction where crosshair aim, but I think I can found workaround for this.

But player must and should turn only if crosshair try to go out of bound of this red circle. Like, if crosshair tries to go beyond the most upper borders of circle - player camera turns up, most left border - turn left, down border - turn down, south-west border - turn in south-west direction, etc.

I remember I see something like this before, but it was made using acs script, and I need zscript version.

Top