• Hey! Register here to create your account, engage with the community, and talk about what is new!

How do you detect if a player is completely static?

thefatnoob

New member
Joined
Jul 13, 2022
Messages
1
Reaction score
0
it feels like im missing an obvious answer but im struggling to detect when a player isnt moving at all. the velocity vector seems rounded to 2dp and unusable to detect if the player is moving, since it for some reason isn't <0,0,0> when still. it seems excessive to have variables detecting on every movement type event. is there an easier way to check if a player isn't moving at all (discounting pitch and yaw)?
 
Solution
The best way to do it is, store the old location and then compare it with the new one (make sure you set the pitch and yaw to 0)
To do it, in a Loop place a Set Variable: Set Location Direction, in the first slot put a variable of your choice (preferably LOCAL), in the second slot, put Game Value: Location and in the 3rd slot put a Vector(1,0,0) then place an If Variable: =, in the first slot put the same variable and in the second slot put a variable that will contain the old player location (it should be a GAME variable, let's call it %default old location), and put your code between the pistons, then after the pistons place a Set Variable: Set Location Direction, in the first slot put the %default old...

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,260
Reaction score
356
The best way to do it is, store the old location and then compare it with the new one (make sure you set the pitch and yaw to 0)
To do it, in a Loop place a Set Variable: Set Location Direction, in the first slot put a variable of your choice (preferably LOCAL), in the second slot, put Game Value: Location and in the 3rd slot put a Vector(1,0,0) then place an If Variable: =, in the first slot put the same variable and in the second slot put a variable that will contain the old player location (it should be a GAME variable, let's call it %default old location), and put your code between the pistons, then after the pistons place a Set Variable: Set Location Direction, in the first slot put the %default old location, in the 2nd slot put a Game Value: Location and in the 3rd slot put a Vector(1,0,0). The reason we set the %default old location after the if is so we check if they are equal then set it, if we put the set variable before the if it will always be true (since we are updating before we check).
 
Solution
Top Bottom