Tuesday, 19 March 2013

Jye 19/03/2013

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:

  1. hits = Physics.RaycastAll (cam.position, cam.forward, 100.0);
  2. for (var i = 0;i < hits.Length; i++) {
  3. //var hit = hits[i];
  4. hits[i].collider.SendMessage("ApplyDamage", (damage/(i+1)), SendMessageOptions.DontRequireReceiver);
  5. sparks.rotation = Quaternion.FromToRotation(Vector3.up, hits[i].normal);
  6. Instantiate(sparks, hits[i].point, sparks.rotation);
  7. if(hits[i].rigidbody){
  8. hits[i].rigidbody.AddForceAtPosition(cam.forward*(force/(i+1)), hits[i].point);
  9. }

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