Creating a rotating portalgun
In this tutorial we will be creating a portal gun pedestal which automatically rotates and fires portals in four directions.
You will need two
prop_dynamic entities, one for each of the following world models:
models/props/pedestal_base_reference.mdl. Name it
pedestal_bottom_modeland set its "Disable Shadows" keyvalue to Yes. Place it on the ground where you want the pedestal to be, with the small doors just below the ground.
models/props/pedestal_center_reference.mdl. Name it
pedestal_top_model. Place it right above
pedestal_bottom_modelas shown in the image below.
Create two brushes, both textured with the
tools/nodraw texture. These will be tied to entities later on.
- 32 x 32, height 4, centered above the pedestal.
- 4 x 32, height 56, placed next to the pedestal.
Select the 32x32 brush and tie it to a
func_door_rotating entity with the following properties:
Property Name Value Name pedestal_rotating_door Delay Before Reset -1 Spawn Position Closed Speed 30 Distance 90
Tie the second brush to a
func_door set to these properties:
Property Name Value Name pedestal_retracting_door Speed 25 Move direction: 90 0 0 Delay Before Reset -1 Lip 1
Passable flag on both entities.
weapon_portalgun and name it
pedestal_gun. Move it exactly on top of
pedestal_top_model. The portalgun should face left when you’re looking at the pedestal from the front (the side with the blue arrow display), like the one shown in the first picture at the top of this page. You may wish to disable the "Can Fire Portal 1" or "Can Fire Portal 2" keyvalues to give the player a single-color portal gun.
ambient_generic entities. Set the following properties on each one:
- Name the first
pedestal_sound_rotate, set its sound name to
Portalgun.pedestal_rotateand the Source Entity to
- Name the second
pedestal_sound_charge, set its sound name to
Weapon_CombineGuard.Special1and the Source Entity to
- Name the third
pedestal_sound_open, set its sound name to
Buttons.snd22and the Source Entity to
Add the following outputs to
To make the pedestal instead fire orange portals, replace
Add the following output to
Add the following outputs to
Parenting and creating the hole
Now just parent
pedestal_top_model, and that to
pedestal_rotating_door. Since the pedestal retracts into the floor, you will need to make a cylindrical hole on the floor beneath
pedestal_bottom_model, like the one shown in the image to the right.
You may want to create a portal frame on each wall the portals are going to be fired at. To do this, create a
prop_static entity with the model
models/props/autoportal_frame/autoportal_frame.mdl (Portal 1) or
models/props/portal_emitter.mdl (Portal 2), move it to the wall you wish to place it at, and rotate it until it is parallel to the wall.
Pedestal opening animation
You may also want to make the pedestal open when the player gets near it. To do this, create a 192 x 192, 128 high brush with the
tools/toolstrigger centered on the pedestal. Tie it to a
trigger_once entity with the following outputs:
If you do not do this, you may wish to remove
pedestal_sound_open and the output to close the pedestal on