Tornadoes

Another fun physics entity is the Tornado. In this recipe, we will look at placing one down and allowing this tornado to roam around the level. We will also demonstrate it picking up and throwing around multiple AI Grunts.

Getting ready

  • Open My_Level.cry within the Sandbox
  • Place down a dozen AI Grunts

How to do it...

Place down the Tornado entity by doing the following:

  1. In the RollupBar, click on the Entities button.
  2. Under the Environment section, select Tornado.
  3. The default values for the tornado will not be sufficient to lift up the AI Grunt, so we will have to adjust the following values:

    SpinImpulse = 40

    UpImpulse = 40

    AttractionImpulse = 100

With these properties set, the next time we enter into game mode, the tornado will start to wander around and pick up and toss the AI Grunts. Even the player himself can get caught in this and be pulled around by the tornado.

How it works...

The Tornado entity is a special entity that applies multiple forces into a defined radius around the entity. These forces are the same forces as described previously with SpinImpulse, UpImpulse, and AttractionImpulse. You can also add in a WanderSpeed, which will allow the tornado to wander around in a random direction that will still follow the terrain.

There's more...

The p_draw_helpers property, when set to 1, debugs the funnel of the tornado. As the particle of the tornado does not scale with the physics of the tornado itself, you may see a debug rendering of the radius and the spline of the tornado by using p_draw_helpers = 1.

There's more...Tornadoesworking
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.177.86