-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Reference this thread on the KSP forum from about a year ago http://forum.kerbalspaceprogram.com/index.php?/topic/121017-thermal-mechanics-and-physicssignificance/#comment-2478242
I can't remember which version of KSP it was at the time, but NK confirmed in that thread that when raycasts were used by engine exhaust to determine where heat should be applied, it was being applied to the wrong part if the actual "hit" part was physicsless.
BD Armory currently suffers exactly the same problem.
The issue is in pooledBullet.cs on line 254, specifically:
hitPart = Part.FromGO(hit.rigidbody.gameObject);
This causes a walk up the part tree to the first "physics" part.
However, the solution is to do exactly as NathanKell indicated in that forum thread... return the first actual part instead. And happily. code to do this correctly is also found in another file in BD Armory. The ModuleWeapon.cs implementation for lasers at line 1242 works as expected: if the laser actually hits a physicsless part then the following code correctly returns it:
Part p = hit.collider.gameObject.GetComponentInParent<Part>();
I have recompiled BD Armory on my machine, with the following single line change, which corrects the error. In pooledBullet.cs at line 254, remove
hitPart = Part.FromGO(hit.rigidbody.gameObject);
and replace it with
hitPart = hit.collider.gameObject.GetComponentInParent<Part>();