i spent the day trying to figure out the part of the gun script responsible for the penetration factor of the rail gun. i tried working with this script:
- hits = Physics.RaycastAll (cam.position, cam.forward, 100.0);
- for (var i = 0;i < hits.Length; i++) {
- //var hit = hits[i];
- hits[i].collider.SendMessage("ApplyDamage", (damage/(i+1)), SendMessageOptions.DontRequireReceiver);
- sparks.rotation = Quaternion.FromToRotation(Vector3.up, hits[i].normal);
- Instantiate(sparks, hits[i].point, sparks.rotation);
- if(hits[i].rigidbody){
- hits[i].rigidbody.AddForceAtPosition(cam.forward*(force/(i+1)), hits[i].point);
- }
}
but there were too many errors, so i halted work on the penertration and constructed the ammo counter constraint for the guns.
No comments:
Post a Comment