Vertical LookVector Value needed

Hi :smiley:

Goal:
I want to let the player (in First Person) throw a ball in the direction they are looking (i.e. take the direction the player is looking and apply an impulse to the ball in the regarding direction).
I dont want a fixed throwing angel, but allow the player to choose.

What I tried and failed with so far
The LookVector property I used

Player.Character.HumanoidRootPart.CFrame.LookVector

only provides useful information in the horizontal plane. The .y return values in the e-07 range. I guess this happens because the player head moves left/right but not up/down.

I also had issues with Camera, mainly I had trouble accessing it in a local script (which is somewhat necessary for me).

Does someone have an idea how to solve this? :smiley:

If i wasn’t clear enough, I am happy to provide more detailed explantions

Hello!
To get the LookVector of the player’s camera, it is as easy and as intuitive as this:

workspace.CurrentCamera.CFrame.LookVector

This vector represents the direction the camera is pointing to, so you don’t have to limit yourself to the direction the character is facing. Because each client has their camera, you have to do this locally.

2 Likes

Thank you so much :smiley:
As I said, I already tried this, but obviously the wrong way^^
Works perfectly now :+1:

1 Like