|
| 10 May 2013 06:57 PM |
I'm trying to figure out how to point a character's arm at the mouse's current location. However, I have no clue how to do this. I've tried in vain to understand welds and cframes, but alas I only grasp the basics of these two. Could anyone help me figure how to get a character's arm to point towards the mouse's location? |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 08:09 PM |
| Is there anyone to help me? |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 08:10 PM |
| It's quite an involved calculation, let me see if I can dig it up... |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 08:14 PM |
This is how I did it:
local j=the player's shoulder joint local torso=the player's torso local targetPosition=point to point at --This part sets up the joint (only have to do it once) j.C0=CFrame.new(1.5,0.5,0)--Do -1.5 if you want the left shoulder j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0) --This part points it (do this every time you want it to point) local pos=torso.CFrame:pointToObjectSpace(targetPosition) j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)--here too |
|
|
| Report Abuse |
|
|
|
| 11 May 2013 12:50 PM |
| Your code works rather well, but when a gun is welded traditionally onto the arm, it is held to the side similar to a try-hard 'thug' type of person. |
|
|
| Report Abuse |
|
|