[url]http://wiki.garrysmod.com/?title=Entity.GetElasticity[/url]
[url]http://wiki.garrysmod.com/?title=Entity.GetFriction[/url]
Has anyone got these new functions to work? They returned a lua error for me when I added them as e2 functions and connected an entity.
[code]
e2function number entity:elasticity()
if not validPhysics(this) then return 0 end
local phys = this:GetPhysicsObject()
return phys:GetElasticity()
end
e2function number entity:friction()
if not validPhysics(this) then return 0 end
local phys = this:GetPhysicsObject()
return phys:GetFriction()
end
[/code]
I think that you should tell this to the wire mod forum,since they need to correct it.
Might be a conflicting addon,you didn't tell us which error was afterall.
I don't think it's a wire problem though, I've created functions before like this. I also talked to a wire dev who has made hundreds and he said there was no issue with the wiremod side of it. The message is;
[quote]
Expression 2 (phy patch test): [RunString:4025] attempt to call method 'GetFriction' (a nil value)
[/quote]
I was just wondering if anyone has managed to use these functions outside of wiremod.
Entity.GetElasticity, not PhysObj.GetElasticity:wink:
Hah, that was it.
[code]
e2function number entity:elasticity()
if not validEntity(this) then return 0 end
return this:GetElasticity()
end
e2function number entity:friction()
if not validEntity(this) then return 0 end
return this:GetFriction()
end
[/code]
It's not giving the error any more, but instead is returning a value of 1 for both outputs, no matter what the physical properties of the prop are.
What is wrong now?
bump
Sorry, you need to Log In to post a reply to this thread.