Quantcast
Viewing all articles
Browse latest Browse all 75

Bullet Marks on surfaces with bump mapping?

else { //bullet must have hit a wall/floor/object in level Debug.Log("AK47 shot hit:" + myCollision.gameObject.name); var contact : ContactPoint = myCollision.contacts[0]; Debug.Log("contNormal:" + contact.normal); //problem here: normals come from bump mapping normals, //not actual geometry of the surface var splatOrientation : Quaternion = Quaternion.FromToRotation(Vector3.up, contact.normal); var splatPosition : Vector3 = contact.point + 0.5*contact.normal; Instantiate(bulletSplat, splatPosition, splatOrientation); } So, I have gun and I'm spawning a plane with a transparent texture at the point where bullets hit surfaces to make bullet marks. All of my surfaces are flat. This was all working fine until I made my surfaces bump mapped, so the contact normals are now all over the place because they are following the lighting normals of the bump map, not the actual geometry of the walls/surfaces. And the splats/bullet marks are orientated the wrong way, according to the bump map normals, using contact.normal. Q: How do I get the geometric normals of the object at the point of contact?

Viewing all articles
Browse latest Browse all 75

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>