phys:IsPenetrating()

How does this work? Does it return the entity it’s “penetrating”? The wiki page has little information.

Sorry I couldn’t help laughing at this.

I think it means if a entity is inside the world or another entity. I may be wrong though.

physobject:IsPenetrating(entity)

returns true if it’s penetrating the entity you pass.

Also, function name is amusing.

Indeed, the function name is amusing and the first time I read it I lol’d. But thanks FlapJack, this function may be of some use then.

A quick example of this function:

[lua]
local avaster = Entity(1):GetPhysicsObject()
local stan = Entity(2)

if avaster:IsPenetrating(stan) then
avaster:Explode()
end
[/lua]

haha

I’m not entirely sure this is true.
I use it like this in my gamemode:
[lua] local p = ent:GetPhysicsObject();
if (not IsValid§) then
ent:Remove();
player:Notify(“You cannot spawn that car at this time.”,1);
error(“No physics for model '”…model…"’! ("…ITEM.name…","…player:Name()…")");
elseif (p:IsPenetrating()) then
player:Notify(“You cannot spawn your car there!”, 1);
ent:Remove();
return NULL;
end[/lua] and it returns if the car is inside anything, prop or world.

Maybe works both ways:rolleyes:

It does not take a parameter it will return true if your penetrating anything.

If your penetrating a prop and ask it player.GetAll()[1]:GetPhysicsObject():IsPenetrating(ents.GetAll()[1]) – World.
It will return true because your penetrating something, even if it is not the world.