Jump to content

SetInput always in front direction of Player ?


Slastraf
 Share

Recommended Posts

I want to make the player always walk into the direction it looks with the setinput function.

If you rotate it and call SetInput(0,4,0) it will walk +4 on a particular axis (in this case z ?),

it will set the player rotation to 0 while walking and not walk into the front.

What would be some math to fix this ?

Link to comment
Share on other sites

SetInput already moves player in his local axis. First parameter is rotation angle, don't set it to 0, set it to angle you want player to look at. And second parameter will move player forward in that direction.

Check out default FPSPlayer script, it sends camera rotation as first parameter, z input as second and x input is third.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...