ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 10 Jun 2014 04:05 PM |
How would I get this type of CFrame:
CFrame.new(LookPosition,BrickPosition)
Where you can get a part to look at something working with a weld? I have been looking at toWorldSpace and toObjectSpace but I don't really understand them.
If it helps you in explaining, I want to make the head always looking at the mouse.Hit |
|
|
| Report Abuse |
|
|
L0cky2013
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 1446 |
|
| |
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 10 Jun 2014 05:16 PM |
Can ya go more indepth pl0x?
I have a fakehead welded to a torso with the C0 of 0,1.5,0
I don't really know exactly though |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
| |
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
| |
|
|
| 11 Jun 2014 02:56 PM |
| I can make the entire body look at the mouse, but not the individual head. It's really difficult and annoying to do something like that since you'd actually have to use the Neck weld. |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2014 02:58 PM |
It would be something similar to this:
char.Torso.Neck.C0=CFrame.new(cam.CoordinateFrame*3,0,0) for first person It might be C1 instead. You really shouldn't do it with the mouse, but you can try mouse.Hit.y instead for mouse: char.Torso.Neck.C0=CFrame.new(mouse.Hit.y*3,0,0) |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 11 Jun 2014 03:30 PM |
Hmm well I am using a fake neck weld, but welding it to a fake torso(for leaning capabilities)
So would I just change the C1 to CFrame.new(mouse.Hit.p.Y*3,0,0) ?? |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2014 03:33 PM |
| Yeah, but it might be C0. I'm not certain which. |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 11 Jun 2014 03:39 PM |
Well I have this in a while loop
fhw.C0 = CFrame.new(0,1.5,0)*CFrame.Angles(mouse.Hit.p.Y*3,0,0)
fhw is the weld for the fake head and the fake torso
also it doesn't work :/ |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
| |
|
L0cky2013
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 1446 |
|
|
| 11 Jun 2014 03:51 PM |
| .C0=CFrame.new(LookPos, Brick Pos) |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 11 Jun 2014 06:59 PM |
I tried this but still it didn't work...
fhw.C0 = CFrame.new(Vector3.new(mouse.Hit:toObjectSpace().X,mouse.Hit:toObjectSpace().Y,mouse.Hit:toObjectSpace().Z),Vector3.new(0,1.5,0)) |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
| |
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
| |
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
| |
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 12 Jun 2014 12:12 PM |
| I really need help with this for a bunch of things so bump again |
|
|
| Report Abuse |
|
|
L0cky2013
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 1446 |
|
|
| 12 Jun 2014 12:13 PM |
| r u trying to make the head look at the mouse vertical or diagonal? |
|
|
| Report Abuse |
|
|
L0cky2013
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 1446 |
|
| |
|
|
| 12 Jun 2014 12:16 PM |
You guys need to understand that joints work in object-space orientations. You need to make it relative.
For instance, this is how to point the head (neck weld) to a position:
Neck.C1 = (CFrame.new(Neck.Part1.Position, LOOKAT)):toObjectSpace(Neck.Part0.CFrame * Neck.C0) |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 12 Jun 2014 12:24 PM |
@Dr
Omy thats great can you explain it! I understand the toObjectSpace method now but can you explain the math :O |
|
|
| Report Abuse |
|
|
|
| 12 Jun 2014 12:33 PM |
The beginning:
CFrame.new(MainPosition, LookAt) Makes a CFrame with the position at MainPosition and the rotation facing LookAt.
:toObjectSpace(Neck.Part0.CFrame * Neck.C0)
Takes the CFrame.new() part and turns it into relative coordinates. What coordinates does it make it relative to? The thing inside toObjectSpace's parenthesis.
For joints, you always want the C1 to be relative to Part0's CFrame. Part0's CFrame is the joint's main center. However, you need to multiply the C0 against Part0's CFrame to get the position of Part1.
Why? Because Part1's position is equal to:
Part0.CFrame * C0
Notice how I put that in :toObjectSpace
|
|
|
| Report Abuse |
|
|