How to use SetModelScale() ?

This doesn’t seem to work for me.

self.Entity:SetModelScale(self.Entity:GetModelScale() * 1.25, 1)

The first argument is the overall scale; the uniform scale. The second number is the time (in seconds) to scale.

So ent:SetModelScale(2, 5) would scale to 2 in 5 seconds.

Also, self.Entity: is deprecated, just use self: (assuming you’re coding a SENT and .Entity isn’t something you made.

I have this in cl_init, does this look correct?

function ENT:Draw()

self:DrawModel() -- Draw the model
self:SetModelScale(3, 3)


You would need to move it to before you draw the model because you want to change the scale before the model draws.

The time argument won’t work since each frame it’s trying to rescale the model with a timed interval.
If you need to scale on a timed interval, you will need to do it manually with:

Ah, thanks. I had to set the time interval to 0.

self:SetModelScale(3, 0)

[editline]5th May 2014[/editline]

I scaled my prop to half it’s size.

But, I can’t put it against the wall.


You’ll also need to modify the VPhysics constraints.

I’m assuming you kept the same code but changed the interval to 0. While it works, this is probably quite performance intensive I’d imagine, unless GMod is smart and ignores it. Put the scaling bit in ENT:Initialize() instead, if only to learn good coding habits.

– shared.lua
function ENT:Initialize()
if (SERVER) then
– other stuff here

self:SetModelScale(3, 0)

This should help you with the physics.

Alright, I got it.