How to know if a player is looking at a part

I want to make a window that is only vaultable when you’re looking directly at it, and running (i’ve already done this part.) But, im not sure how to go about it.

You can use raycasts, learn more about raycasts here:Raycasting | Documentation - Roblox Creator Hub

I’ve thought about this, but it won’t give me the desired effect, i want the range to be strict, similar to the game Dead by Daylight if you’ve heard of it

Nope, never heard of it can you elaborate more?

the best way to do this is using dot product

2 Likes

i’ve tried this, but as you get closer it still thinks you’re looking directly at it, and you can vault it at a weird angle

i want the player to only be able to vault the window fast when they’re running and looking directly at it, if you try and vault it at an angle or while not running it will do a slow vault

3rd person or 1st person? (char)

it’s in 3rd person, but the movement is a little different from normal, i can provide a video if you want, but i don’t think it should effect anything

I got it to work, i just needed to change the lookvector to the windows look vector and not the players, and used a raycast to make sure the player is facing the window

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.