|
| 16 Oct 2016 05:22 PM |
| When I click I'd like the player to face in the direction I clicked and then go back to normal, how can I do this? |
|
|
| Report Abuse |
|
|
Mr_Gibus
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 368 |
|
|
| 16 Oct 2016 05:26 PM |
This is a layered script but here are some links that can help you.
http://wiki.roblox.com/index.php?title=API:Class/Mouse http://wiki.roblox.com/index.php?title=CFrame
Here is a pastbin of part of the code you will need
GhTk8Yy3 |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:49 PM |
uh what I mean is, I do this -
function repos(part,mouse) part.CFrame = CFrame.new(part.CFrame.p,mouse) end
repos(plr.Character.Torso,mouse.Hit.p)
but my problem is, when it's over they have to jump in-order to actually go back to properly standing, if they shoot upward or downward they're left kinda tilted, how can I fix this? |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:50 PM |
| Turn off AutoRotates in their humanoid. The game tries desperately to rotate the character correctly in mid-air if you dont. |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:54 PM |
| That never fixed my current problem tho ;-; |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:56 PM |
Well of course it does.
If you turn off AutoRotates it will prevent the game from trying to rotate your character. Duh... hence "Auto Rotate"
Turning that off will force your character to look in that direction.
If you want them to stop trying to turn up and down, multiply the mouse's position by Vector3.new(1,0,1) and add Vector3.new(0,thing.Position.Y,0) so that it will now be at the same height as 'thing' |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:58 PM |
| No, I've tried the AutoRotate thing and it still leaves my character lob sided, I want them to be able to fire up and down I just don't want it to leave them tilted once they do |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:59 PM |
| If you want them to 'fire' up and down then move the arms instead of the torso by using the C1 of the joints and angling it based on the Y |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 05:59 PM |
| Take the mouse's position and form a new vector that ignores the Y axis. |
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 16 Oct 2016 06:04 PM |
| Turn auto rotate off when you're attempting to make them face a direction, then turn it back on when you're done. Also, ignore the y-axis (well technically don't ignore it, just set the y-axis to the y coordinate of the torso's CFrame) |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 06:09 PM |
plr = game.Players.LocalPlayer m = plr:GetMouse() char = plr.Character
script.Parent.Activated:connect(function() plr.Character.Humanoid.AutoRotate = false local tpos = char.Torso.CFrame.p char.Torso.CFrame = CFrame.new(char.Torso.CFrame.p,m.hit.p)
wait(1) plr.Character.Humanoid.AutoRotate = true char.Torso.CFrame = CFrame.new(tpos)
end)
uh... it's not working ;-; |
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 16 Oct 2016 06:12 PM |
plr = game.Players.LocalPlayer m = plr:GetMouse() char = plr.Character or plr.CharacterAdded:wait() local hum = char:WaitForChild('Humanoid')
script.Parent.Activated:connect(function()
hum.AutoRotate = false
local tpos = char.Torso.CFrame.p char.Torso.CFrame = CFrame.new(char.Torso.CFrame.p,Vector3.new(m.Hit.X,char.Torso.CFrame.Y,m.Hit.Z))
wait(1)
hum.AutoRotate = true
end)
try that |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 06:19 PM |
| I want the player to be able to fire upwards and downwards though and I don't mind if they face up or down during the cast but once it's finished I'd like if they stood straight ;c |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 06:21 PM |
Move their arms instead of their torso then ._.
Also simply reset their cframe to look at their own position but moved forward (ignoring Y axis) |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 07:05 PM |
| take uber shotgun from the Library. It Faces Player in the direction you shot. It's a big hunk of fudge, but maybe you will get some ideas from the code. |
|
|
| Report Abuse |
|
|