How can I keep the zombie on the ground?

EDIT: I won’t be able to see suggestions until tomorrow for me so sorry for no replies!

Hi. I am working on a zombie framework that allows a lot of zombies. Basically, the server calculates a position for the zombie to go to and the client takes that information and renders accordingly. However, I am getting some pretty interesting results like this:

Another one:

How can I keep the zombie on the ground and prevent stuff from happening like this? I know I can do some collision group stuff where the zombie can’t collide with the player. Also, I am thinking of ray-casting on the ground to do it, but I still don’t know how it will work. Please leave some suggestions or methods for ray casting I could use. Thanks!

Can we see the script? Maybe you accidentally have the position a few studs higher in the Y-axis?

oh ok. here’s the script calculating the cframe for the zombie to be in.

function thing:update(dt) =, linear * 60 * dt)

it is basically the player’s cframe but lerped ( the linear part is just an alpha ), which is probably the reason why it does the weird floating thing

The Y height of the character should be determined by a downcast from the NPC’s root for any surfaces or should be freefalling (constantly subtracting from the Y axis) if there are no surfaces to stand on as is done for the Humanoid.

so instead of what I am doing, i would:

  • lerp only the Z and X
  • raycast in the server from the root of the NPC down
  • check for surfaces; if none, add gravity so that it is on the ground

is that what you meant?

I’m not entirely sure what you’re doing right now but that sounds about right. It’s more about the way you’re getting the positions of each axis: X and Z can continue to be handled the way they currently are but Y should be dependent on the space below the root. If there is no space, then it should be continuously moving downwards until it finds a surface or reaches the minimum descent (defined by FallenPartsDestroyHeight in the Workspace).

1 Like

Ok. Your solution makes sense so I guess I will try it out.

EDIT: it works thanks.

Well, I am guessing that you do not want to use MoveTo for some reason, and a regular Zombie, That would take care of most of the problem like keeping him on the ground; pathfinding,…