How to tell where the player is looking?

Post » Mon Nov 08, 2010 1:51 pm

Is there a way to tell the exact direction the player is looking?

I know how to get coordinates of the players location and the angle he is looking at but not the exact in terms of looking up or down slightly etc.

What I'm trying to do is find a way of firing a target spell whilst on a horse.

I have it working to fire the palyers spell, but it only goes in one direction as I can't tell exactly what the coordinates the players crosshairs are facing.

Anyone know?
User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm

Post » Mon Nov 08, 2010 5:41 am

I am pretty sure the 'up/down' angle is X.

But it should be easy enough for you to test.

player.getAngle X

User avatar
FITTAS
 
Posts: 3381
Joined: Sat Jan 13, 2007 4:53 pm

Post » Mon Nov 08, 2010 7:55 am

As WillieSea said, X angle is up/down, positive numbers are down, negative are up (Angle X = 89 >> looking straight down)

Angle Z gives you the sideway angle, but, if memory serves, it returns/sets the angle the player BODY is facing, not the head. Therefore, on horseback, it will give you the Z angle of the horse.
User avatar
James Shaw
 
Posts: 3399
Joined: Sun Jul 08, 2007 11:23 pm

Post » Mon Nov 08, 2010 11:40 am

On horseback you can use (player.GetHeadingAngle Horse + Player.GetAngle Z) to get the direction the player is facing. Weird, but it works.
User avatar
FITTAS
 
Posts: 3381
Joined: Sat Jan 13, 2007 4:53 pm


Return to IV - Oblivion