How to add tag for My Terrain in LY 1.24?

How to add tag component for My Terrain in LY 1.24.0? :confused:
I want detect my terrain by Raycast Script Canvas but I can not add tag to terrain, I searched a lot :face_with_monocle: but It is not possible for add my tag to terrain :flushed: :black_flag:

Is there a way to tell me? If it is not possible , IT IS BIG PROBLEM FOR MY 3D VISUALIZATION PROJECT :sob:

—Update 01—
I did raycast on terrain without tag , result is null :confused: :broken_heart:
for entities had collider, result is name entities :white_check_mark:

Hi AhmadKarami,

Got some feedback from the dev team, see below.

  • on StarterGame using TerrainDataRequest
  • take a look at Gems\StarterGame\Characters\Assets\ScriptCanvas\CharacterAudio.scriptcanvas
  • in particular GetMaxSurfaceWeight, from which he can Extract Properties and get the Surface Type
  • needs to configure the terrain surface types in libs\MaterialEffects\surfacetypes.xml

Let us know if this works!

1 Like

Thank you :pray: :slightly_smiling_face: sure , I download Lumberyard 1.25.0 Tomorrow and I test soon… :white_check_mark:

I could be misleading here because I am not a dev, but there should only ever be one level terrain component in your hit result if terrain is hit. If all you want to know is if terrain was hit you should be able to get it by type in the result. Tags are useful when you are trying to find components/entities in a list of same components/entities.

Lmbr_Saulty’s answer is the next step and will get you surface information for the properties of the terrain layers, if that is what you want.

1 Like

@microAMZN We must access types of find entities/entity/component vi name/tag/array in script canvas nodes , I think , we must divide the terrain to two group :
1- Terrain Object The ground on which the player can walk/run(That can NOT be destroyed)
2- Terrain entities like grass, trees , etc (That can be destroyed)

This feature is an introduction to a script canvas open world game with destructibility :wink:

I understand. However, there is an important distinction. Although you may have entities that you logically refer to as terrain entities, the word terrain has a specific meaning in the context of Lumberyard. If refers to a type of level component, and there should only ever be one in the level.

You can test for the Legacy Terrain level component any number of ways in your RayCastHit result. A simple fast way is in the Script Canvas mentioned above, keep the terrain EntityID as a variable in the script and test for equality. You could also use the EntityID in the hit result to try to determine the type if you prefer to make the script canvas a bit more hands off.

EDIT: Maybe I didn’t understand. I see you wrote “Objects on the ground that can NOT be destroyed”. These are entities you call terrain objects because they sit on the ground (terrain component) and can be traversed, correct? You can differentiate these objects by giving a unique tag for objects or a property that defines whether they are destructible, and calling their destruction function when they are hit by a ray. Or you could try doing something clever with the EBus, where you send out a destruction event, but I’m not sure how performant this scenario might be if you have a lot of destructible entities.

@microAMZN I worked / had projects with game engines like ue , unity , etc

in unity , when you want delete/destruct trees on the terrain , It is interesting to know that terrain are also destroyed along with trees :wink: Then the player is not the ground on which to walk or run :slightly_smiling_face: I mean, the terrain should not be destroyed, I hope my explanation was sufficient and useful.

Yes, of course , also you can not destroy road or river on the terrain :slightly_smiling_face: Unless changeable C++/Lua/Script Canvas API voxels are destroyed during the game(Edit terrain in run time game), such as a diversion of the river in a major world war, or roads being bombed in the game.