|
| 28 Mar 2013 10:32 PM |
| Scripting Help didn't do it's job, so I'm here. Say the TargetPoint is (30, 5, 30), how would I go about welding the right arm to point at the target? |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2013 10:41 PM |
I can't tell you my secrets.
Oh, and, reported for spam. |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2013 11:20 PM |
Well what I do is weld something in the head and then weld whatever you need, such as a gun or a right arm to the head and move the head's weld around. Use a cool formula like so:
local lv = mouse.Hit:vectorToWorldSpace(Vector3.new(0,0,-1)) neck.C1 = CFrame.new(0,1.5,0) *CFrame.Angles(math.atan2(lv.y,pythag(camera.CoordinateFrame.lookVector.x, camera.CoordinateFrame.lookVector.z))+.1,0,0)
'pythag' just being a function to return math.sqrt(a^2 + b^2) |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 28 Mar 2013 11:35 PM |
It's really simple so long as you understand that joints just use object-spaces and not world coordinates.
local targPoint = Vector3.new(30,50,0) local joint = ? -- The weld or whatnot. -- After setting the parts for the joint, you can set the C1 (or if you're using the default character joints, just set joint to the Right Shoulder) joint.C1 = CFrame.new(joint.Part1.Position, targPoint):toObjectSpace(joint1.Part0.CFrame |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2013 11:39 PM |
@Causticity Olololol. That's too complicated. Here's what I do:
local Pos = Torso.CFrame:pointToObjectSpace(Mouse.Hit.p) ArmWeld.Part0 = Torso ArmWeld.Part1 = RightArm ArmWeld.C1 = CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0) ArmWeld.C0 = CFrame.new(Vector3.new(1.5,0.5,0),Pos)
Oh, and, reported for spam. |
|
|
| Report Abuse |
|
|