Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making arms point relative to the position of the CurrentCamera?

Asked by 10 years ago

Example: http://www.roblox.com/BATTLEFIELD-place?id=114127058

I want to make the arms point relative to where the CurrentCamera is looking. The reason why I want to calculate off of the Camera instead of the Mouse is because I plan for the mouse to be in the middle of the screen (First Person) when pulling this off. Now, I know this sort of requires two sets of arms, one for the screen (fake arms in the CurrentCamera), the other for the character (the real arms, so that the other players can see where the player is aiming). I already know how to set the fake arms in the CurrentCamera, but unfortunately, I don't know how to position the real arms. I would like to use the SetDesiredAngle method in the Motor6Ds to move the arms up and down, but I do not know the math to set the angle to point to the Camera, any help?

2 answers

Log in to vote
0
Answered by
Bebee2 195
10 years ago

For best effect, you weld the fake arms onto the real arms and make the fake arms non-transparent when the focus and the coordinate's delta magnitude is less than 1.

You then weld the real arms onto the head and make a new weld that replace the Neck Motor6D.

You move the head towards the camera something like

Weld.C0 = Weld.Part1.CFrame:inverse()*
CFrame.new(C0Numbers,C0Numbers+UnitVector)
*CFrame.Angles(rotation)
*CFrame.Angles(Offsetrotation)
0
What is a delta magnitude, which C0 numbers, which unit vector, and which rotation? evolvedpikachu 40 — 10y
0
By that I mean if the length of the vector between the two points are less than 0. C0 numbers is the number you would use as normal for C0. UnitVector is well... The direction you wanna look at. Rotation is how you wanna rotate it along with the offset rotation. Bebee2 195 — 10y
Ad
Log in to vote
0
Answered by 4 years ago

for FPS I prefer to use R6 real arms this is my local script:

plr = game.Players.LocalPlayer;
repeat wait() until plr.Character
char = plr.Character
m = plr:GetMouse()
game["Run Service"].RenderStepped:connect(function()
local c = game.Workspace.CurrentCamera

char.HumanoidRootPart["RootJoint"].C0 = CFrame.new(0,0,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55,3.15,0)

    char.Humanoid.CameraOffset = (char.HumanoidRootPart.CFrame+Vector3.new(0,0,0)):pointToObjectSpace(char.Head.CFrame.p + Vector3.new(0,-1.46,0))

end)

Answer this question