of     1   

ZQFMGB12
#141336253Thursday, July 24, 2014 1:52 AM GMT

I need a method or algorithm to check if a player is grounded. A player is grounded when there is a solid part beneath the player's feet. I know that there is an event that belongs to Humanoid that fires (Enum.HumanoidStateType.Landed) when the player is lands, but I feel that the event is inaccurate. For example, if a player spin jumps (custom scripted action) and there is a part right on top of the player, the grounded event won't fire and the script won't work. This is because in the script, a spin jump has a debounce variable and it becomes false when the player is grounded. Does anybody have any ideas?
128GB
#141336283Thursday, July 24, 2014 1:52 AM GMT

ray casting
IAmTheRolo
#141336338Thursday, July 24, 2014 1:53 AM GMT

raycast
ZQFMGB12
#141336341Thursday, July 24, 2014 1:53 AM GMT

elaborate please?
Tynexx
#141336346Thursday, July 24, 2014 1:53 AM GMT

And/Or maybe magnitude
128GB
#141336430Thursday, July 24, 2014 1:54 AM GMT

'And/Or maybe magnitude' yes loop through every single item in the game instead of sending a line to see if there is anything 2.5 blocks below the torso other than the legs what could go wrong
ZQFMGB12
#141336455Thursday, July 24, 2014 1:54 AM GMT

Will ray casting work even though the part is rotated in any of the three axes?
128GB
#141336650Thursday, July 24, 2014 1:56 AM GMT

It'll work as long as you check if something is below the feet It won't matter what it is or how its rotated as long as you check directly below the feet Would probably want to make it check if said brick is cancollide = true though
Notunknown99
#141336702Thursday, July 24, 2014 1:56 AM GMT

Not really :L
FertileTurtle
#141336814Thursday, July 24, 2014 1:57 AM GMT

char.Humanoid.Changed:connect(function() if char.Humanoid.Jump.Value == true then repeat wait() until char.Torso.Velocity.Y == 0 print'Ground' end end) I tested it and it works fine, it has about a second delay though.
FertileTurtle
#141336883Thursday, July 24, 2014 1:58 AM GMT

char.Humanoid.Changed:connect(function() if char.Humanoid.Jump == true then repeat wait() until char.Torso.Velocity.Y == 0 print'Ground' end end)
ZQFMGB12
#141337036Thursday, July 24, 2014 2:00 AM GMT

That won't work because not all extra movements I'm including make Humanoid.Jump become true.
Notunknown99
#141337179Thursday, July 24, 2014 2:01 AM GMT

So long as they do not fall over, you can just use the ray: Ray.new(torso.Position, Vector3.new(0, -3.05, 0)) and it will return if they are grounded (Most of the time) (Will not work if they are not fully on a part) (Will not work if they are standing on something with lots of small holes in it)
ZQFMGB12
#141337481Thursday, July 24, 2014 2:04 AM GMT

I don't plan to be too evil with platform placing yet (0.2x0.2x0.2 stud platforms) because of the new awkward traction physics on Roblox
Notunknown99
#141337668Thursday, July 24, 2014 2:06 AM GMT

You can also make the entire collidable world invisible and make the fancy visual stuff non-collide (Or use CSGs when they eventually appear) :P
128GB
#141337917Thursday, July 24, 2014 2:08 AM GMT

@Not 0.2 x 0.2 x 0.2 blocks set to cancollide = false still bug your character out when you touch them sometimes
Notunknown99
#141337972Thursday, July 24, 2014 2:09 AM GMT

@128GB: Oh, yeah. I forgot this was ROBLOX.
ZQFMGB12
#141339176Thursday, July 24, 2014 2:21 AM GMT

Raycasting works beautifully...for now! Wasted 120 robux trying to fix some animations before ray casting.
blockoo
#141339687Thursday, July 24, 2014 2:26 AM GMT

If I were to do this, I would do something with the "FreeFalling" and "Running" events of the Humanoid.
[rfa#hidefromsearch]
#141340928Thursday, July 24, 2014 2:38 AM GMT

[rfa#hidefromsearch]
ZQFMGB12
#141341378Thursday, July 24, 2014 2:42 AM GMT

@blockhoo Been there, done that, the enums aren't very accurate for what I'm trying to accomplish. For example, when you spin jump, my movement script sets a variable to false and when you touch the ground, it becomes true. Say you spin jump right under a part. If I used Enums, the events wouldn't fire because the player appears to have not jumped, but the variable is still set to false (which disallows jumping). I think ray casting for now is the superior option.

    of     1