Cameras in zscript

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Cameras in zscript

Post by Apeirogon »

I want to made camera which show what player have behind him in the upper side of screen, like rearview mirror.
Is it possible to do so using only zscript?
User avatar
krokots
Posts: 266
Joined: Tue Jan 19, 2010 5:07 pm

Re: Cameras in zscript

Post by krokots »

I think that's totally possible. I created something extreme similar in FamiliarDoom - a little view from familiar. Check out either my code (ZScript/HUD, hud mini camera) or try to experiment with function in TexMan class

Code: Select all

native static void SetCameraToTexture(Actor viewpoint, String texture, double fov);
You'll need to make a dummy actor which always will be at the same position as player, but looking opposite direction.
User avatar
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

Re: Cameras in zscript

Post by Matt »

Check out the test files in this bug report.

(hopefully the bug in question will be fixed by the time you implement this)

For the angle and position you might need to have an actor that constantly follows the player and sets its angle to the player's minus 180.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Cameras in zscript

Post by Apeirogon »

...and also change camera pitch to (-player.pitch).

Return to “Scripting”