generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: CFramin' Welds

Previous Thread :: Next Thread 
ToboboT is not online. 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 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
10 Jun 2014 04:19 PM
Manipulate the neck
Report Abuse
ToboboT is not online. 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 is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
10 Jun 2014 09:11 PM
Anyone know how?
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
11 Jun 2014 02:54 PM
Bump?
Report Abuse
Imacheeseburger is not online. Imacheeseburger
Joined: 16 Jun 2011
Total Posts: 142
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
Imacheeseburger is not online. Imacheeseburger
Joined: 16 Jun 2011
Total Posts: 142
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 is not online. 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
Imacheeseburger is not online. Imacheeseburger
Joined: 16 Jun 2011
Total Posts: 142
11 Jun 2014 03:33 PM
Yeah, but it might be C0. I'm not certain which.
Report Abuse
ToboboT is not online. 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 is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
11 Jun 2014 03:46 PM
Bump
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
11 Jun 2014 03:51 PM
.C0=CFrame.new(LookPos, Brick Pos)
Report Abuse
ToboboT is not online. 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 is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
11 Jun 2014 07:12 PM
Bump???
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
11 Jun 2014 07:31 PM
Bumop
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
12 Jun 2014 11:54 AM
Bump
Report Abuse
ToboboT is not online. 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 is not online. 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 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
12 Jun 2014 12:14 PM
horizontal*
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
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 is not online. 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
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image