Dynamic PlayerPawn properties?
Moderator: GZDoom Developers
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!)
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!)
- lumbo7332
- Posts: 36
- Joined: Fri Jul 27, 2018 10:21 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Fedora Kinoite
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Dynamic PlayerPawn properties?
I'm looking to be able to dynamically adjust the player's view height based on whether they are aiming down the sights of a rifle or not. Is this possible?
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Dynamic PlayerPawn properties?
You can change the viewheight property on the playerpawn, but I haven't checked how exactly it would interact with crouching.
EDIT: you may need to multiply the height by player.crouchfactor or something similar.
EDIT: you may need to multiply the height by player.crouchfactor or something similar.
- lumbo7332
- Posts: 36
- Joined: Fri Jul 27, 2018 10:21 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Fedora Kinoite
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Dynamic PlayerPawn properties?
Can you do it dynamically based of in-game input?Matt wrote:You can change the viewheight property on the playerpawn, but I haven't checked how exactly it would interact with crouching.
EDIT: you may need to multiply the height by player.crouchfactor or something similar.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Dynamic PlayerPawn properties?
Try putting in your playerpawn's Tick() somewhere and give it a try:
A correction to my previous post: best to only manipulate "player.viewheight" (a property of the player thinker) not "viewheight" (a property of the player pawn) since that's the way it's done in the crouching code.
Code: Select all
if(player.cmd.buttons&BT_ZOOM)player.viewheight=viewheight*0.8*player.crouchfactor;
else player.viewheight=viewheight*player.crouchfactor;