How to convert GetPlayerInput FORWARD/SIDEMOVE into float?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Nash
 
 
Posts: 17506
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

How to convert GetPlayerInput FORWARD/SIDEMOVE into float?

Post by Nash »

I don't understand the number that's being returned from GetPlayerInput(-1, INPUT_FORWARDMOVE) (or SIDEMOVE)... all I want is to convert this value so that 1.0 (or -1.0) means that full movement is being applied. With the keyboard, this value should always be +/-1.0, while with an analog stick, any value up to a maximum of +/-1.0.
User avatar
Nash
 
 
Posts: 17506
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: How to convert GetPlayerInput FORWARD/SIDEMOVE into floa

Post by Nash »

Meh, found the answer to my own question. Leaving this thread up for future reference.

My solution was wrong.
User avatar
Nash
 
 
Posts: 17506
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: How to convert GetPlayerInput FORWARD/SIDEMOVE into floa

Post by Nash »

Actually, I haven't correctly figured it out. I'm still looking for a solution. I want to convert the player's input into a float value, where 1.0 is the maximum.
carlcyber
Posts: 163
Joined: Thu Jan 27, 2005 1:04 am

Re: How to convert GetPlayerInput FORWARD/SIDEMOVE into floa

Post by carlcyber »

Just make a quick investigation about this. The number 12800 is obtained by GetPlayerInput directly. That's the base concept even the number is not correct. Ther are two different values for side move, 12800 from mouse strafing and 10240 from movement keys. The attachment can be run directly to see the result.
Attachments
NashMove.pk3
(1.05 KiB) Downloaded 34 times
User avatar
Nash
 
 
Posts: 17506
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: How to convert GetPlayerInput FORWARD/SIDEMOVE into floa

Post by Nash »

Thanks carlcyber! Makes me wonder why is it that strafing seems to be "slower" than forwardmove... :S
Blzut3
 
 
Posts: 3215
Joined: Wed Nov 24, 2004 12:59 pm
Operating System Version (Optional): Kubuntu
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: How to convert GetPlayerInput FORWARD/SIDEMOVE into floa

Post by Blzut3 »

Nash wrote:Makes me wonder why is it that strafing seems to be "slower" than forwardmove... :S
Strafing is slower. That how SR-50 works. (By using multiple strafe keys you are able to max out the axis, but it can also be achieve through a mouse or joystick axis without disabling turn.)
User avatar
Nash
 
 
Posts: 17506
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: How to convert GetPlayerInput FORWARD/SIDEMOVE into floa

Post by Nash »

Ah, I see. Thanks for the clarification.
Locked

Return to “Editing (Archive)”