|
| 06 Jan 2015 01:54 PM |
I am currently working on a localscript that has the player rotate in the direction of the mouse, but I am unable to have the player's head increase/decrease its attitude.I have been trying to figure this out.
I tried something along the lines of:
local direction local Mouse = player:GetMouse() -- Player is already defined
head = player.Character.Head. direction = (Mouse.Hit.p-head.Position).unit head.CFrame = CFrame.new(head.Position) * CFrameAngles(math.asin(direction.Y),0,0)
It angles the entire body to follow the pitch that is supposed to only be working for the head, and cancels the other part of the script that I have to rotates the players body along the x and z axis. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 06 Jan 2015 02:32 PM |
local player = game.Players.LocalPlayer local character, mouse = (player.Character or player.CharacterAdded:wait()), player:GetMouse() neck = character.Torso.Neck wait(3) mouse.Move:connect(function() neck.C1 = (CFrame.new(character.Head.Position, mouse.Hit.p)):toObjectSpace(character.Torso.CFrame * neck.C0); end) |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2015 03:13 PM |
For the most part it works 128GB, but the head can go off of the neck.
Thank you for your help |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 06 Jan 2015 03:18 PM |
I can't help you anymore than I already have, sorry it doesn't work correctly
Maybe you can look at some models of guns that do that, |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2015 03:49 PM |
It's fine, I wasn't expecting you too xD
I was just saying I really appreciated your help :3 |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2015 03:52 PM |
128GB
I think you have a voodoo script on me.
When I tried your code, my necked cracked and now I can't turn my head to the right o_O
Now I'm sitting here in pain.
Lawsuit incoming. xD |
|
|
| Report Abuse |
|
|