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 » Scripters
Home Search
 

Re: welding to head to follow mouse

Previous Thread :: Next Thread 
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
12 Jul 2016 05:41 PM
I'm trying to get 3 parts to follow the player's mouse vertically when in first person. To do this, I weld the parts to the head. I'm not sure where I go from here, do I rotate the welds C1? If so, to what?


Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
12 Jul 2016 05:46 PM
weld the parts to another part that is welded to the head

that way you only have to change the weld of the part that is connected head

and only vertically

you can do some trig for the math
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
12 Jul 2016 05:48 PM
I have other welds attached to the parts I want to move, welded to the torso, and I'm using these welds to animate a gun with reloading and such

If I do what you suggested, that won't interfere with those animations, right? Like if they look up they can still reload properly?


Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
12 Jul 2016 06:04 PM
Here's what I would set the C1 of the Neck joint to, in a loop:

local origin = Torso.Position + Vector3.new(0,1.5,0)
local lookAt = Mouse.Hit.p
local objSpaceVector = CFrame.new( origin, Vector3.new(origin.X, lookAt.Y, origin.Z) ):toObjectSpace(Torso.CFrame * Neck.C0)
Neck.C1 = CFrame.new(0,-.5,0) * (objSpaceVector - objSpaceVector.p)

That will make the head follow the mouse vertically.
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
12 Jul 2016 06:09 PM
so would the head moving not kill the player? I assumed it would
and would moving the head then move the arms if I welded them to the head?


Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
12 Jul 2016 06:10 PM
no if you move the Neck joint the player will stay alive
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
12 Jul 2016 06:12 PM
how do i move the neck joint? i've never used joints before


Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
12 Jul 2016 06:13 PM
torso.Neck.C0 =

torso.Neck.C1 =
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
12 Jul 2016 06:32 PM
so it's just a weld?
thanks


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
12 Jul 2016 08:19 PM
@nox that didn't work for me


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
13 Jul 2016 12:47 PM
bumo


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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