Mow a Meadow with Torque 3D

First you have to Download the whole Torque 3D Sourcecodes (https://github.com/GarageGames/Torque3D).

Then get the Sourcecodes in Visual Studio -> look here: https://www.youtube.com/watch?v=uh0EFeh-Fyk

Then we need to know, that we want to change the Groundcover on a specific position in the TerrainEditor (it’s not possible to do this in „play“ mode at the moment – I’m working on it – maybe someone could help?). Therefore we need to change the Terraintexture on this position and can then layer the Groundcover on it.

So we now make the file (we will name it) „mow.cs“ in the „scripts/server/“ folder of your game directory.

And we put the following in this file:

 

At the next step we need to add this script into the „scriptExec.cs“-File in the „scripts/server/” Folder of your Game Directory. Add this line somewhere in the file:

Okay, now we need one last change in a Torque-File – it’s called „EditorGui.ed.gui“ and you find it here „tools/WorldEditor/gui/ “. Open it and change the line:

to

Now open the File „terrainEditor.cpp“ in Visual Studio and add this code somewhere in the file:

And add the header file in “terrainEditor.cpp”:

On the end of the other “.h” files at the top of the “terrainEditor.cpp” file.

Now at last do the following -> edit the “terrainEditor.h” in Visual Studio. Here we need add the following Code somewhere in this file:

Congratulations – now just compile and you have a working function to change the “TerrainTexture” at the Position from the Player!

Now let’s start your game after compiling it!

Okay – we want to change the groundcover on the position of the player – so we just need to layer some terrain material on the type of your groundcover.

The Settings for the Groundcover should be:

Okay Now – what to do here?

We need to name the Terrain (in our case “test”) – Object in your Name you did on the start of this tutorial in “mow.cs”.

Further use your desired terrain texture, which is set as meadow – so only there the grass, would be.

And use “grass1” in our case as a TerrainTexture – this would be replaced and so there is a “mowing effect” because you layered it on another Texture 😉

And make sure, that the “probability” is checked.

Okay now you are ready!!!

Just open the console in the Terrain Painter Editor and type “start_mow” now just walk through your Groundcover and have look at this cool thing – if you want to stop “mowing” just use “stop_mow” 8)

So now this Tutorial is understand as an RFC Document – so you are welcome to send me your Comments.

Best Regards!

Robert

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.