[Camera Demo] Playground swing

Handy guides on how to do things, written by users for users.
Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

[Camera Demo] Playground swing

Postby gwHero » Mon Oct 02, 2017 12:18 pm

So I started a megawad a few years ago. Had a lot of fun in creating it, but I never finished it and nothing was published since I made a lot of beginner's mistakes and did not feel to start all over again with the same theme.

However, some parts might be worth sharing. The first level contained a city map that had a children's playground with a swing, so I have put this into a demo wad to illustrate what you can do with camera's in GZDoom. Experienced modders might know all the way, but for newbies it might be useful. Also, if someone wants to have a swing for a city map that's a little bit more than just decoration, here's a start...

It's not a 'real swing' in a way that sectors are moving (maybe it could be done with polyobjects but I'm not sure if that would be very convincing since these cannot have floors), but it's done with camera's to give the illusion of a swing.

I have included the demo wad so you can try the swing yourself. After starting the wad in GZDoom, just step on one of the swings (no too fast), and it will automatically start. As long as you stand still, you'll keep swinging :) Just press forward or backward again to step off.

(note: if you do not step on the swing in the middle of the seat, but more to the edges, it can happen that the swing cord is blocking you, preventing you from stepping off the swing with the forward key - just use the backward key in that case)

Technical details.
At each side of each swing, linedefs are placed to start or stop the swing by executing a script when a player crosses them (one line is for stepping on, the other one for stepping off; events are triggered only from the front sides to distinguish the actions). The first parameter tells the script if the swing must be started or stopped, the other parameters are the camera tid's. Each swing has 2 camera's, one for each direction.

Screenprint:
[imgur] https://imgur.com/a/YNCbj[/imgur]

Map detail:
[imgur] https://imgur.com/a/93j1Q[/imgur]

Script:
Code: Select allExpand view
script 30(int swing, int camera, int camera2)
{
   if (swing==1)   // step on
   {
      SetActorProperty(0, APROP_RenderStyle, STYLE_None); // hide the player
      Thing_Activate(camera);
      ChangeCamera(camera, 0, 0);
      Thing_DeActivate(camera2);   // disable other camera
   }
   else   // step off
   {
      SetActorProperty(0, APROP_RenderStyle, STYLE_Normal); // bring player back
      Thing_DeActivate(camera);
      ChangeCamera(0, 0, 0);   // switch back to player view
      Thing_DeActivate(camera2); // disable both camera's since player can step off from the other side
   }
}


For more details, just open the map in GZDB bugfix.


Remark 1. The swing itself works in OpenGL as well as the software renderer. However, because I used 3d platform slopes for the construction of the swing in the demo, these parts will not be visible in the software renderer. To use the swing in a map that should support the software renderer, change the construction poles.

Remark 2. To reduce the number of tags and 3d floors, the construction of the swing uses multiple tags per sector. You have to use GZDB bugfix to edit/view these correctly.

Used techniques: camera's, 3d floors, 3d slopes, ACS scripting
Attachments
MAP01.wad
Demo wad swing
(42.42 KiB) Downloaded 48 times
User avatar
gwHero
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands

Re: [Camera Demo] Playground swing

Postby Zen3001 » Sun Jan 28, 2018 12:58 pm

you could creat 3d models with a swinging animation
User avatar
Zen3001
Cannot the kingdom of salvation take me home?
 
Joined: 25 Nov 2016
Location: some northern german shithole
Discord: #0629


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests