trvlydre
(NOX trvlydre)
December 30, 2024, 4:15pm
#1
I want the item to follow the camera but it’s just staying here and rotating with the camera. I want it to be like the player is holding the item.
video
rs.RenderStepped:Connect(function()
item.Parent = workspace.CurrentCamera
item.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(1,0,0)
end)
The offset I added is so that it is a little to the right of the camera like it’s being held in their right arm
1 Like
Maybe you could use a weld constraint to attach it to their hand? And then you could keep your current script for the rotation.
2 Likes
trvlydre
(NOX trvlydre)
December 30, 2024, 4:26pm
#3
If I attatch it to their hand, wouldn’t the item just stay at their hand if they look up? I want it to move sort of like a viewmodel like this
The way I did it in this video was by having a part with an offset and I attatched the offsetted part to the camera, but I don’t wanna do that with every tool in the game
1 Like
Ahh I get it now. Unfortunately, I have absolutely no idea how to do that. I wish you good luck finding a solution though!
2 Likes
skewercase
(crossfade)
December 30, 2024, 4:34pm
#5
ur adding when u should be multiplying:
item.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(1, 0, 0)
1 Like
happya_x
(Happya)
December 30, 2024, 5:00pm
#6
the direction a CFrame is facing is called LookVector
so the point in front of the camera would be
camera.CFrame + (camera.Cframe.LookVector * distanceInFrontOfCamera)
where distanceInFrontOfCamera is the number of studs in front of the camera
1 Like
trvlydre
(NOX trvlydre)
December 30, 2024, 5:20pm
#7
Thank you and @happya_x , what’s the difference between adding and multiplying the CFrame?
happya_x
(Happya)
December 30, 2024, 6:12pm
#8
you cant do cframe + cframe, but you can do cframe + vector3
multiplying cframes is like adding two numbers
1 Like
system
(system)
Closed
January 13, 2025, 6:13pm
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.