Whenever I call this function on any entity it NEVER returns true... Do I need to call it on the physent or the entity itself?
[lua]
if self.Entity:OnGround() then
print("LOL")
else
print("BOBANDBOB")
end
[/lua]^ this always print "BOBANDBOB" even if the entity is sitting on the ground doing absolutely nothing.
Afaik that only works for npc's and players.
Yeah, only for any objects with MOVETYPE_WALK. Also, Entity:GetGroundEntity() != NULL works better.
Except traces there's no way to check if an entity is on the ground?
[QUOTE=iRzilla;26433141]Use [B]one[/B] trace.[/QUOTE]
Yup. I'm wondering when to call the trace though, I made a movement system for entities but I'm trying to have the best jumping function I can have, so far it just checks when the player (entity) is on the ground to jump but does so every button press (spacebar).
I was thinking about a function that would check when the entity's vertical vector is around 0 and if it is, look if it's on the ground and allow jumping = true.
What do you think is the best solution?
The ground is not always at zero and they could land on a prop, you'd be better with a small trace below the player that checks if it hit the world or an object.
A single trace every time they jump isn't a big deal.
[QUOTE=-TB-;26520645]The ground is not always at zero and they could land on a prop, you'd be better with a small trace below the player that checks if it hit the world or an object.[/QUOTE]
I meant vertical velocity, when he's not going up nor down.
But I'll keep it the way it is I guess.
Sorry, you need to Log In to post a reply to this thread.