I’m having an issue using GetAimVector() while a player is in a seat ( ex: airboat seat).
I have made some crappy mspaint pics to illustrate the problem.
The black line to the left illustrates a wall.
The red laser is the players real aim vector (where the player really is looking at).
The green laser is the aim vector I get when using GetAimVector().
When the seat is snapped to the default angle there is no problem using GetAimVector().
http://img35.imageshack.us/img35/1289/99065974.jpg
When the seat is tilted it will not return the correct aim vector.
http://img39.imageshack.us/img39/5725/78201408.jpg
http://img2.imageshack.us/img2/943/75429485.jpg
I have tried to find a way to compensate it but failed.
Here is the code
[lua]
local Dir = self.Entity.User:GetAimVector()
local plyPos = self.Entity.User:GetShootPos()
local trace = {}
trace.start = plyPos
trace.endpos = plyPos + (Dir * 50000)
trace.filter = { self.Entity, self.Seat }
local tr = util.TraceLine( trace )
local hitpos = tr.HitPos
self.DotLaser:SetPos(hitpos)
[/lua]
self.DotLaser is a sprite.
self.Entity.User is the player that’s currently using the seat.
Any ideas?