• phys:IsPenetrating()
    8 replies, posted
How does this work? Does it return the entity it's "penetrating"? The wiki page has little information.
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.
[QUOTE=iRzilla;24671223]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][/QUOTE] haha
[QUOTE=|FlapJack|;24671158]physobject:IsPenetrating(entity) returns true if it's penetrating the entity you pass. Also, function name is amusing.[/QUOTE] I'm not entirely sure this is true. I use it like this in my gamemode: [lua] local p = ent:GetPhysicsObject(); if (not IsValid(p)) 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.
Sorry, you need to Log In to post a reply to this thread.