- Home /
3D Objects and Alpha
Hello! I'm developing an Overhead 3d game, and can't seem to find a way to create collision , or influence a Boolean using alpha. What I am aiming to do is create the boundaries for an area using png alpha, then have the player object be able to detect the level of alpha (color.a) at it's position, in accordance to the picture it is above. The picture is on a 3d plane.
Can you show us a picture or drawing of what you are attempting to do? In general it is very difficult to define areas using alpha, but if you are looking at the alpha for a entire plane, then it become much easier.
The alpha of the texture on the plane is varying. The green section has a alpha of 50, while the blue area has an alpha of 40 and the grey section has an alpha of 30. > http://puu.sh/2BpwB <
You could probably do a Physics.Raycast from your object down through the plane, get the coordinates of the hit, convert that to plane coordinates, normalize them [0 to 1], and then use that to lookup the alpha value of your texture. That would only give you the exact pixel alpha of where the object is, but you could do other samples around it to try to detect a collision radius.