- Home /
Get color pixel from terrain, with a WheelCollider!
Hello, how i can get the color pixel, from a point in the texture terrain? But the point, need do the point that a wheel collider, collided with the terrain.
For sample, I have a car, and your wheels. I did a simple dust emitter in your wheels, and I want to the particles, that get out from emitter, have the color of texture that the wheel collided on terrain.
I know that I can use the Raycast, bui I can't associate this funtion to solve this.
Thanks
Answer by Uniquesone · Oct 04, 2011 at 12:32 PM
Hmm something like that?
function OnCollisionEnter(collision : Collision) {
// Debug-draw all contact points and normals
for (var contact : ContactPoint in collision.contacts) {
Debug.DrawRay(contact.point, contact.normal, Color.white);
}
Yes, but how I can get the texture color from this point? Thanks
http://unity3d.com/support/documentation/ScriptReference/TerrainData-detailPrototypes.html
This contains texture details... but I think it isnt that easy to get exactly a single color.. cause a wheel collider will always colide with more then one color..
Your answer
![](https://koobas.hobune.stream/wayback/20220612234643im_/https://answers.unity.com/themes/thub/images/avi.jpg)