Liam0102 / Star-Wars-Vehicles

Star Wars Vehicles addon for Garrys Mod (Code only)
3 stars 2 forks source link

FPV Pilot Rendering Issue/Fix #14

Closed dhkatz closed 6 years ago

dhkatz commented 6 years ago

Too lazy to make a PR.

https://github.com/Liam0102/Star-Wars-Vehicles/blob/008d2db4b347c2bcb554ce13dd494384b82eff94/lua/entities/fighter_base.lua#L1642-L1651

Currently, when switching to FPV in a ship, your pilot is hidden (I assume to avoid view collision issues). However, drawing of all other pilots is also disabled, meaning ships look like nobody is flying them.

This can be fixed by simply adding IsDriver to the draw check:

https://github.com/Liam0102/Star-Wars-Vehicles/blob/008d2db4b347c2bcb554ce13dd494384b82eff94/lua/entities/fighter_base.lua#L1646

to:

if(IsFlying and (SW_GetFPV() or self:GetFPV()) and IsDriver) then

Then, only the pilot's avatar gets its draw disabled. I'll admit I only tested this with one other person, but we both have no issues with this fix. I had to do a similar fix for my cockpits in my ship addons.