Still trying to figure out how to make something moved when not looked at,

I’ve tried for like 3 hours now and I got no idea what to do. How do I make it so that when I am looking at a part it stays still, but when I turn around it moves? Are there any methods for this?

1 Like

What I would do to approach this is to see if the player can see the part on their screen. If the player cannot see the part, it will then move. It may be the same attempt you are trying to do, but the hint is to check if the part is on the screen.

1 Like

thats what i’ve been trying to do, sounds easy in theory, but i can’t figure it out

1 Like

Maybe try using dot product

there is something called
camera:WorldToScreenPoint() which returns two things

a vector3 of where it is on the screen with a depth
a boolean that says if its on the screen

you can use the boolean to tell if the camera can see the object

example from docs:

local camera = workspace.CurrentCamera
local worldPoint = Vector3.new(0, 10, 0)
local vector, onScreen = camera:WorldToScreenPoint(worldPoint)

local screenPoint = Vector2.new(vector.X, vector.Y)
local depth = vector.Z

thank you, you just saved me so much time

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