Hello,
What I have here is that it follows the mouse but here are two things i want to fix
- The arm to rotate relative to the shoulder instead of just the position of the arm
- The arm to rotate like the velocity of the mouse
If the mouse goes diagonally left down, then the arm should orient right down
Like this insteaed of just going down without taking into account the velocity of the mouse hit
Also basically I want the arm to go the orientation ofthe look of the mouse which it goes around like a hollow sphere so when there are new objects it doesn’t just update like a very weirdly and stuff
So like a sphere and stuff and so it ignored the parts so it doesnt just go to the part because it appeared and stuff so basically just ignore everything for mouse hit is that possible can i do it pleas eplease please
Hello,
Here’s my script BTW.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame
local armWeld = Instance.new("Weld")
armWeld.Part0 = char.Torso
armWeld.Part1 = char["Right Arm"]
armWeld.Parent = char
local camera = game.Workspace.CurrentCamera
local mouseRaycastParams = RaycastParams.new() --workspace
local function getMouseHit(mousepos)
local unitRay = camera:ViewportPointToRay(mousepos.X, mousepos.Y)
return workspace:Raycast(unitRay.Origin, unitRay.Direction * 250, mouseRaycastParams)
end
RunService.RenderStepped:Connect(function()
local cframe = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.Angles(math.pi/2, 0, 0)
armWeld.C0 = armOffset * char.Torso.CFrame:toObjectSpace(cframe)
end)
It’s late and I don’t know what I’m doing. Explain to me how I can make this work?
Hello,
So this is a diagram
Hello,
This is my other post explaining further in depth how this works BTW.
Thought you guys should check it out to be able to help me more, pretty stuck right now.TheInfo I’ve gathered since this post is that it should actually go around in a sphere formation, an infinite amount of circle paths in every orientation basically, yeah, based on the movement of the mouse in the workspace allthewhile ignoring everything in workspace so there are no sudden moves. Gotchya.
Hello,
I tested your script and it does not work.
wait(2)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
mouse.TargetFilter = workspace
local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame
local armWeld = Instance.new("Weld")
armWeld.Part0 = char.Torso
armWeld.Part1 = char["Right Arm"]
armWeld.Parent = char
local lastmou
game:GetService("RunService").Heartbeat:Connect(function()
if char and char:FindFirstChild("Torso") then
local RightShoulder = char.Torso:WaitForChild("Right Shoulder")
local X = -(math.asin((mouse.Origin.p - mouse.Hit.p).unit.y))
local _, Y, Z = RightShoulder.C0:ToEulerAnglesXYZ()
RightShoulder.C0 = CFrame.new(RightShoulder.C0.Position) * CFrame.Angles(X, Y, Z)
end
end)
My arm goes inside my torso.
Hello,
I did some math and it seems like I got it with UpVector and RightVector but for some reason setting the c0 of the armweld would make my arm float and it’s very weird because when I rotate my character and make it fall the arm just moves back and it stays there
wait(2)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
mouse.TargetFilter = workspace
local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame
local armWeld = Instance.new("Weld")
armWeld.Part0 = char.Torso
armWeld.Part1 = char["Right Arm"]
armWeld.Parent = char
local lastmou
RunService.RenderStepped:Connect(function()
lastmou = mouse.Hit.p
local e = Instance.new("Part",workspace)
e.CFrame = CFrame.new(char.Torso.Position+char.Torso.CFrame.RightVector+char.Torso.CFrame.UpVector, mouse.Hit.Position)
e.Anchored = true
e.CanCollide = false
e.Size = Vector3.new(1,1,1)
game:GetService("Debris"):AddItem(e,.05)
local cframe = CFrame.new(char.Torso.Position+char.Torso.CFrame.RightVector+char.Torso.CFrame.UpVector, mouse.Hit.Position)
armWeld.C0 = cframe * CFrame.Angles(math.pi/2, 0, 0)
end)
Very weird indeed
Hello,
Is this what you are talking about when arm pointing upwards have issue?
wait(2)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
mouse.TargetFilter = workspace
local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame
local armWeld = Instance.new("Weld")
armWeld.Part0 = char.Torso
armWeld.Part1 = char["Right Arm"]
armWeld.Parent = char
local lastmou
RunService.RenderStepped:Connect(function()
lastmou = mouse.Hit.p
local e = Instance.new("Part",workspace)
e.CFrame = CFrame.new(char.Torso.Position, mouse.Hit.Position)
e.Anchored = true
e.CanCollide = false
e.Size = Vector3.new(1,1,1)
game:GetService("Debris"):AddItem(e,.05)
local cframe = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.Angles(math.pi/2, 0, 0)
armWeld.C0 = armOffset * char.Torso.CFrame:toObjectSpace(cframe)
end)
I have no idea how to fix it and if you could please help me that would be fine
- Br, iSyriux