Post tutorial Report RSS Tutorial 04 - Forcefields

This tutorial shows how to setup forcefields to create jump-pads, wind or any other thing.

Posted by on - Basic Mapping/Technical

Let's start from an empty boxy map.


1) Jump Pads
The entity you should use to create a jump pad is the good old func_forcefield.
Draw a brush where the jump pad should be, texture it with the caulk texture and then create the func_forcefield entity.
In this example, I choose to place it on the ground in order to throw the player up in the air.

Now we need to configure the forcefield to fit our needs. As you can see in the editor in the entity inspector, a func_forcefield has lots of keys you can set.

Select the forcefield and set the key/val "applyVelocity" "1", that tells the forcefield to apply a new velocity on touching entities.
Since we want the forcefield to start on, we also set the key "start_on" "1"

Now we have to specify the direction and the intensity of the velocity to apply.
There are 2 ways to do this:

- Way 1: "uniform" key

Add the key/val "uniform" "0 0 900" (or any other number you please).
"0 0 900" is the vector that specifies the velocity to apply: in this case it's a positive velocity on the Z axis.

Tip: Useful values for the "uniform" key:

"0 0 500" //throw the player UP
"0 0 -500" //throw the player DOWN
"0 500 0" //throw the player to the LEFT
"0 -500 0" //throw the player to the RIGHT
"0 -500 500" //throw the player to the RIGHT + UP


- Way 2: target entity

Place a target_null in the map and makes the forcefiled to target it.
The direction and the lenght of the arrow you get defines the direction and the intensity of the velocity to apply.

Move the target further to increase the power of the forcefield.

Tip1: If "start_on" is "0" or not set, then you'll need to trigger the forcefield to activate it.
Tip2: Trigger a forcefield as many times you want to toggle its state.

NOTE: always make sure the origin of a func_forcefield is where you want it. Shift+i centers the origin inside the forcefiels bounds.


2) Wind
Doom3's func_forcefield cannot do much more than a jump pad.
Our new func_forcefield_hq2 entity instead allows you to do also smooth movements. :)

Let's do a wind coming out of the ground that pushes everything up in the air.
Place a new brush, texture it with the caulk texture and then create the func_forcefield_hq2 entity.

Now drag up its upper side in order to increase its height.
Note that the origin it's still down there, where the wind it's suppose to come from!

Now we have to specify the direction and the intensity of the velocity to apply.
This is the same as the func_forcefield: we can use the "uniform key"-way or the "target entity"-way.
I choose to use "uniform key" method, so I add the key/val "uniform" "0 0 30".
Then again, we set "applyVelocity" "1" and "start_on" "1".

We also need to add new keys:
- "decrease_w_dist" "1" <-- tells the forcefield that its power should be lower for entities far from its origin.
- "oldVelocityPct" "0.99" <-- the higher its value is (from 0 to 1), the smoother the movement will be. "0.99" means very smooth.

That's it! Now we have a wind pushing up any entity that it's touching. Its power will be maximum near its origin (near the ground) and almost zero at the top.

Tip1: You may want the wind to be still a bit powerful also at the top. You can add the key "dist_radius" to manually specify the distance (from its origin) where the power should be zero.

Now you are ready to place a func_emitter to give a visual representation of the wind.


3) Implosion and explosion
A func_forcefield_hq2 can also "suck in" or "push away" other entities toward/from its origin. Like a black hole and... well, its opposite. :)

Let's do a forcefield that "sucks in" everything toward its center.
Fist, create another func_forcefield_hq2 entity. This time though, we want its origin to be at its center (while it was near the ground for the wind).
The settings are just like the ones we used for the wind, except for "implosion" instead of "uniform".

Done!
You can increase/decrease its power thanks to the "implosion" key/val.

Let's place a func_emitter also here:

Tip1: You can set the key "explosion" instead of "implosion" in order to repel instead of sucking in.
Tip2: Again, you can set the key "dist_radius" to manually specify the distance (from its origin) where the power should be zero.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: