- Home /
Changing terrain texture on contact (collision)
I need to change a terrain's texture at the point it collides with a specific object. How can I achieve that? Thanks in advance! :)
P.S. Adding grass or terrain details at that point would also work for me! :)
Answer by llSalvationll · Nov 01, 2012 at 06:49 PM
Use OnTriggerEnter or OnCollisionEnter and check to see if the collision happened with the object/object type you want to change the texture of. You should then be able to get the material component and use Material.SetTexture to change it to whatever you need it to be.
http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.html
I probably didn't express this very well. $$anonymous$$y problem is not getting collision, it is changing a certain part of a terrain not the whole of it...
Answer by nathanwick · Jul 25, 2018 at 04:06 PM
I have the same problem. Please tell me if you figure it out!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Line showing at the top of my tall grass 3 Answers
Collide with trees? 1 Answer
Better way to flatten terrain at runtime under a building? 2 Answers
Hide Grass and Trees applied to terrain? 2 Answers