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 all
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
}
}
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