So I don’t know how to do so a prop follows the player’s looking direction. So far I got a code that follows the player, and it works pretty well, but I want that same prop to rotate where the player is looking. I am doing a flashlight, and, like I said it works pretty well, I used a spotlight and it looks like a flashlight, but I want this same prop to rotate to where the player is looking.
This is the code:
prop_follows_player_device := class(creative_device):
@editable
FollowerProp : creative_prop = creative_prop{}
DoFollowPlayer()<suspends> : void =
loop:
if (PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[0].GetFortCharacter[]):
PlayerPosition : vector3 = FortniteCharacter.GetTransform().Translation
FollowerProp.MoveTo(PlayerPosition, rotation{},0.2)
else:
break
Print("Follow")
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
DoFollowPlayer()