Rolling a freaking can

I am making a sent that is just a can that is supposed to roll. In the ENT:Think function, I have:

physobj:AddAngleVelocity(Angle(0, 0, 10000))

It looks like it’s trying to roll, but it’s really just flying up off the ground about every 2 seconds. This seems so simple, but I can’t figure out how to simply make a can roll. Can somebody show me how dumb I am and tell me how to do it.

I always use vectors, but you could probably do

local angular = physobj:LocalToWorldAngles(Angle(1000,0,0))

That’s assuming AddAngleVelocity is a world function, which I believe it is.

No, it doesn’t work. The can twitches on the ground a little, but doesn’t roll at all, no matter what I change the numbers to.

This might seem dumb and unrelated but maybe you should start with something bigger and then work your way down. Source doesn’t have the most realistic physics and it’ll probably be much easier to roll something bigger like a barrel. Once you get the hang of it you’ll be able to scale it down.

Perhaps it’s sticking to the ground? Try giving it a little big Z velocity while turning it. Just a suggestion though.

Good idea. And if alse fails you might want to use simulated physics. That way you’ll be certain it would do as you ask it to.

No, it’s definitely not sticking to the ground. How do the wheels that you can make with the wheel toolgun work?

Turns out it uses a motor constraint.


That means you probably can’t use it on a single entity.

Try increasing the mass of the can a little and applying more force

physobj:AddAngleVelocity(Angle(0, 0, 10000)*100)

Angle velocity doesn’t produce much force since it is based off of the friction of the ground to propel it. If you wanted to propel the can enough to make it roll as an effect of the cause, you’ll need to use :ApplyForceCenter with a vector corresponding to the direction you want it to roll, and apply a force that is greater than the ground’s friction.

I want it to be like a wheel though, which goes forward because of friction.

You could look at this addon.