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: Best way to detect which way a player is moving

Previous Thread :: Next Thread 
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 08:56 AM
like, moving left, right, forward, back, forward right, forward left, back left, back right.


would I just check isKeyDown? Don't feel like that's the most reliable method.


- pyth_n
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
22 Jul 2016 08:58 AM
MoveDirection i think
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/MoveDirection


mom wheres the spaghetti | R$19,427
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2016 08:58 AM
It probably would be
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2016 08:59 AM
I guess not
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:00 AM
"Displays the direction that the Humanoid has been set to move (using the Move method)."

does the control script use moveto?

this is for FPS dynamic movement, so if you move left the gun sort of sways to the left.


- pyth_n
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
22 Jul 2016 09:01 AM
yea, it updates movedirection if you move with your keyboard


mom wheres the spaghetti | R$19,427
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:03 AM
okay. Will it work with the .Changed method or should I use keyboard input changed?


- pyth_n
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:03 AM
"method"

**event


- pyth_n
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
22 Jul 2016 09:04 AM
yea it'll work with .changed


mom wheres the spaghetti | R$19,427
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:08 AM
shoot me i hate vector3's...


going to have to do something with the humanoidrootpart lookvector I assume?


- pyth_n
Report Abuse
kangerujack is not online. kangerujack
Joined: 08 Nov 2009
Total Posts: 690
22 Jul 2016 09:13 AM
HumanoidRootPart.CFrame.lookVector * 500 is forward
HumanoidRootPart.CFrame.lookVector * -500 is backward
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:15 AM
Trying to convert it to a vector in relation to the player, like


Vector3.new(-1,0,0) is directly back
Vector3.new(1,0,0) is directly forward


etc etc


as evidenced, I have no idea what I'm doing. Trying to picture it on a 2D plane.
print(Character:WaitForChild('HumanoidRootPart').CFrame.lookVector.unit - (Character:WaitForChild('Humanoid').MoveDirection).unit)


- pyth_n
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:18 AM
prntscr/bw5hd2 shoot me


- pyth_n
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
22 Jul 2016 09:24 AM
find the angle and if it's >45 && >315 then forward, >45 && <135 then left etc.
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
22 Jul 2016 09:24 AM
less than 45 for forward sorry ^^
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:28 AM
there should be a way to get a vector the way i said like

Vector3.new(-1,0,0) is directly back
Vector3.new(1,0,0) is directly forward
Vector3.new(0,0,-1) is directly right
Vector3.new(0,0,1) is directly left
Vector3.new(-.5,0,-.5) is back right


i just cant math


- pyth_n
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:31 AM
I feel like this should work

Events.Dynamic = Character:WaitForChild('Humanoid').Changed:connect(function()
print('Dynamic',(Character:WaitForChild('HumanoidRootPart').CFrame.lookVector - Character:WaitForChild('Humanoid').MoveDirection).unit)
end)


- pyth_n
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
22 Jul 2016 09:31 AM
do you want it to just be those or stuff like (-0.25, 0, -0.75) is in between back and left but more back.
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:32 AM
on roblox can't you only move in 8 directions because of how keyboard input works?


- pyth_n
Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 09:33 AM
like on an xbox you can move any variation of degrees because of how a joystick, but with WASD on a keyboard you can only move 8 directions


- pyth_n
Report Abuse
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
22 Jul 2016 10:01 AM
Um, you can move in any variation of degrees by going into first person and rotating your mouse?


Report Abuse
pyth_n is not online. pyth_n
Joined: 21 Jun 2016
Total Posts: 1322
22 Jul 2016 10:04 AM
@Justin,

referring to in relation to the humanoids lookVector. You can only move 8 directions in relation to a single look vector.


- pyth_n
Report Abuse
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
22 Jul 2016 10:05 AM
Ahh, now I see what you mean. I didn't quite understand until you put it like that.


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