GetElasticity & GetFriction not working?

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.



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


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;

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.



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


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