Just a quick question about EyeTrace.

Sup people
Err I need to ask a question about GetEyeTrace.

I’m creating seats in vehicles, and I’m wondering, how could I make it so, the GetEyeTrace, goes through the vehicle and hits the seat?
So it makes it easier for people to jump in the seats.
I thought it would be something to do with offset, but I don’t know how the code structure would be.
Could someone please provide me with a bit of code to do this?

All help is greatly appreciated.

Thank you very much

UniqueGuy

The default GetEyeTrace(), as defined in base gamemode:

[lua]
local meta = FindMetaTable( “Player” )
if (!meta) then return end

function meta:GetEyeTrace()

if ( self.LastPlayerTrace == CurTime() ) then
	return self.PlayerTrace
end

self.PlayerTrace = util.TraceLine( util.GetPlayerTrace( self, self:GetCursorAimVector() ) )
self.LastPlayerTrace = CurTime()

return self.PlayerTrace

end[/lua]

My advice: Leave it alone.

Try this: (Untested!)

[lua]function _R.Player:GetFilteredEyeTrace(tab)

if (self.LastFilteredPlayerTrace == CurTime() and tab == self.FilteredTab) then
	return self.FilteredPlayerTrace
end

local playerTrace = util.GetPlayerTrace(self, self:GetCursorAimVector())
playerTrace.filter = tab

self.FilteredTab = tab
self.FilteredPlayerTrace = util.TraceLine(playerTrace)
self.LastFilteredPlayerTrace = CurTime()

return self.FilteredPlayerTrace

end[/lua]

Do ThePlayerInQuestion:GetFilteredEyeTrace(TheirCar)

Thank you very much. :slight_smile: