[Suggestion] Optional muzzlePosition parameter for gun parts
gyrohero opened this issue ยท 3 comments
This parameter, if used, would allow determining where bullets are spawned, independent from the gun's center.
Some vehicles feature hardpoints that can support different types of weapons. Supporting weapons of different size means that it is best for the point of attachment to be at 0,0,0. However, doing so causes bullets to be spawned there as well, which can be somewhat inaccurate.
(Bonus suggestion) Use a list of muzzlePositions to represent multiple barrels, rocket tubes, missile racks, bomb bay drop points, etc. If the number of muzzlePositions given matches the capacity of the gun, then use (capacity - ammo_count) as the index of muzzlePositions to use when the next bullet is fired. This way, rocket/missile visibility can be toggled off when a rocket/missile has been fired from its respective muzzlePosition.
If the number of muzzlePositions does not match the capacity of the gun, just iterate through the muzzlePositions each time a bullet is fired. This would be useful for multi-barreled weapons like anti-air guns, bomber turrets, and ship guns. If the list only includes one muzzlePosition, it would just use that position, just like the original functionality I mentioned.
If you give me the go-ahead on this, I may try to work on it myself and submit a PR
Having muzzleposition list would help dpl get his slug working both aesthetically and physically. As long as you list positions in order of firing sequence
I agree with all of this. Just be aware that currently, the bullet in a gun fires at the center, offset by the barrelLength. This can probably be supplanted by the muzzlePositions, as for most guns there's no drawback to spawning at the center of the gun except a little slower bullet movement. Also, be aware that some guns' centers don't match up with their muzzle ends. Like tank turrets, for example. Those tilt upwards off-center. Food for thought.