ent:IsOnGround() and ent:OnGround() are not working correctly

For some reason when the entity is not on the ground, the game still thinks that it is. I have tried both of them, ent:IsOnGround() and ent:OnGround() and both of them have the same bug.

Code:
[lua]
local phys = self:GetPhysicsObject()
if self:IsOnGround() then
if phys:GetVelocity():Length() > 0 then print(self:GetClass()…" Is Moving!")
else print(self:GetClass()…" Is not Moving!") end end
[/lua]

Here is a example of how the entity is in the air, but it is still saying that it’s on the ground!

I hope someone has a solution to this! Thanks!

Use a hull trace on the entity using its OBB(Oriented bounding box)

http://forum.facepunch.com/showthread.php?t=1341180

Didn’t work for some reason
Here is the code:
[lua]
function ENT:PhysicsCollide(data, physobj)
print(“Test to see if function is working”)
end
[/lua]

Of course it won’t work, you’re using a SENT hook on an SNPC and that’s not even what I suggested.

I guessed it wouldn’t work but the link you sent had nothing to do with what you said, I read all of the comments of the topic. And sorry for my english…

EDIT: Nah you know what I will just go with the ENT:Touch()
EDIT: Wait nvm that didn’t work, this game really hates Tank SNPCs.
Code:
[lua]
function ENT:Touch(entity)
if entity:IsWorld() then
print(“It touched the world”) end
end
[/lua]

Look into this page, which is the function brandon suggested.

Alright, Its just that I was trying to avoid using Traces since I suck at it…

EDIT: Well finished it, now it makes noises when it walks and yes I hate traces lol
[lua]
local fucktraces = { start = self:GetPos(), endpos = self:GetPos() + self:GetUp()*-5, filter = self }
local tr = util.TraceEntity( fucktraces, self )
if ( tr.HitWorld ) then
local phys = self:GetPhysicsObject()
if phys:GetVelocity():Length() > 15 then print(“This fucking tank is moving”) self:MovingSound()
else vStopSD(self.movingsd1) print(self:GetClass()…" Is not fucking Moving!") end end
if ( !tr.HitWorld ) then
vStopSD(self.movingsd1) print(self:GetClass()…" Is not fucking Moving!") end
[/lua]

Last time I checked it worked correctly on the server but not the client.

Well it doesn’t matter anymore, I found a fix for it also thanks to everyone who helped.