Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Dev_Sebas on October 16, 2013, 06:05:17 PM

Title: Get Terrain Texture Name At Game Object Position
Post by: Dev_Sebas on October 16, 2013, 06:05:17 PM
Hi! :)
Just finished this custom action, it let´s you get the main texture splat map name at a certain game object position.
It´s very useful for example if you what to play a certain footstep sound dependent on your game object position. It will only give you the texture name but you can compare the given name and play different sounds, particles. Very useful for fps/rpg games.
WIP-if script can´t get terrain position it will return null.
All the best
Cheers
Seb
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: choi on October 17, 2013, 08:35:05 AM


Thank you.
This feature is useful.
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: Dev_Sebas on July 15, 2014, 05:07:09 PM
If anyone want to finish this action with some new features it would be nice.
Cheers
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: jeanfabre on July 16, 2014, 09:17:47 AM
Hi,

 Like what features?

 Bye,

 Jean
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: Dev_Sebas on July 16, 2014, 05:23:46 PM
Hi Jean
Well...maybe by now it´s ok, just thinking about optimisation and debug.
It would be nice if incorporated in ecosystem.
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: jeanfabre on July 17, 2014, 08:31:33 AM
Hi,

 Ok, It's up on the ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181), and I made an entry on the RSS (http://feeds.feedburner.com/PlaymakerEcosystem)

I have renamed the class for consistency and added some tooltips as well, but basically it's all good as far as I can see.


 Bye,

 Jean
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: Dev_Sebas on July 17, 2014, 08:58:13 AM
Thanks Jean ;D
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: kici on July 17, 2014, 11:06:37 PM
amazing work you guys.
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: devotid on October 25, 2015, 11:24:47 AM
I am using this but generating my terrains dynamically. Can someone show me how to set the Terrain object with a FSmDefault object variable?  THe only way I can set a terrain now is to drag it in. 

THanks very much for this.
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: foxdeltagames on October 26, 2015, 12:51:22 PM
Will this only work on terrains, or this can be used with any object like custom made floor object?
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: devotid on October 27, 2015, 06:00:39 AM
I am using this but generating my terrains dynamically. Can someone show me how to set the Terrain object with a FSmDefault object variable?  THe only way I can set a terrain now is to drag it in. 

THanks very much for this.

Anybody?
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: Lane on October 27, 2015, 06:58:20 AM
I am using this but generating my terrains dynamically. Can someone show me how to set the Terrain object with a FSmDefault object variable?  THe only way I can set a terrain now is to drag it in. 

THanks very much for this.

Anybody?

Find GameObject by name?
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: devotid on October 27, 2015, 09:37:26 PM
I have done that already and stored it in a object variable. UnityEngine.Terrain but I cannot set the action unless I physically drag the terrain into the action inspector area. There is no way to set a variable to it..... You can ONLY drag it in.

Thus I cannot set it dynamically.

I have tried to alter the action to make it like a FsmDefault drop down but I cannot do it for a Terrain Object.  I simply dont know enough about C# scripting to set up the terrain as a "setable" value.  I have hacked a way for now by using

Terrain.activeTerrain = terrain;

Which will just get the active terrain in the scene that they are currently above... but if the users goes to another terrain it will crash as the terrain is not the "active one"

Thanks again. I really appreciate the help.
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: devotid on November 02, 2015, 04:58:07 PM
Bump.  ::) :)
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: Krillan87 on March 03, 2017, 07:51:33 AM
I would like a bump as well! I tried adding that feature in the scrip but I can't really find where to put it, I seems like choosing a variable is something standard that automatically comes to all actions, so maybe there is not possible to choose the terrain with a variable?  :-\
Title: Re: Get Terrain Texture Name At Game Object Position[SOLVED]
Post by: terri on March 04, 2017, 07:07:36 PM
I felt like I had dealt with this on a project and found this action, tweaked from Dev_Seba's action.
Not 100% sure though but maybe its what you're looking for?

Title: Re: Get Terrain Texture Name At Game Object Position
Post by: jeanfabre on March 06, 2017, 01:56:05 AM
Hi,

 you need to do a ray cast in the down direction, then you will hit the terrain, which will give you access to the gameobject, and then you can query for it name.

 have you tried this?

 Bye,

 Jean
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: Krillan87 on March 10, 2017, 02:54:10 PM
Hi!

Yes a combination of your two solutions worked. Used the other action to specifyy the gameobject and a regular raycast to store the terrain.
Title: Re: Get Terrain Texture Name At Game Object Position
Post by: FractalCore on March 01, 2020, 01:28:16 AM
There seems to currently be two scripts for doing this. The older one required you to drag the terrain object on to the variable slot, "hard-coding" it. Not good.

The newer one named "GetTerrainGameObjectTextureName.cs" posted by terri is better. Lets you set the terrain as a variable. However it seems to be in a broken state. I worked out you have to rename three times Void was used with a capital V. It wanted lower case voids.

Only the first one is in the Ecosystem, probably should be removed in favour of the newer one.

Another thing about the second one. It doesn't end. It acts like it's doing it on every frame but there's no option for that. Someone might like to fix it up, cause it's quite a useful action.