• Creating a ThirdPerson View
    3 replies, posted
I've got my view offset, but the point that the player is looking at isn't the point the view is looking at. i.e. [img]http://puu.sh/3eEqs/adde6d0d1d.jpg[/img] As you can see, the view angle and the player eye angles although the same are looking at different points, as they're parallel. How can I get the angle of the view to face the point the players eyes are looking at? Would anyone mind explaining the math? Cheers :)
Should be as simple as setting some view angles, no? Just throwing the idea out there, I don't have experience with this.
[lua] function GM:CalcView(ply, pos, angles, fov) local view = {} view.origin = pos - (angles + Angle(0, 20, 0)):Forward() * 80 view.angles = angles view.fov = 80 return view end [/lua]
Doesn't the actual point the player is looking at change with range though? Won't I have to account for that? [editline]13th June 2013[/editline] [QUOTE=Minteh Fresh;41018501][lua] function GM:CalcView(ply, pos, angles, fov) local view = {} view.origin = pos - (angles + Angle(0, 20, 0)):Forward() * 80 view.angles = angles view.fov = 80 return view end [/lua][/QUOTE] Similar to what I have at the moment [code] function GM:CalcView(ply, pos, angles, fov) if thirdperson then local view = {} view.origin = pos - (angles:Forward()*100)+(angles:Right()*20) view.angles = angles view.fov = fov return view else return end end [/code] But still, the point the player is looking at changes with range, so wouldn't your code not account for that.
Sorry, you need to Log In to post a reply to this thread.