Question of "Entity:SetMoveType()"

I have made a solid entity which I do not want it to move if anything touches, pushes or applies force on it. So I use this code:
[lua]
function ENT:Initialize()
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_NONE)
self.Entity:SetSolid(SOLID_VPHYSICS)
end
[/lua]
However, the seems not to be solid as I put anything on it will fall within the entity.

By change the second row into
[lua] self.Entity:SetMoveType(MOVETYPE_VPHYSICS) [/lua] it will be solid that nothing can be put ‘into’ it. However, it can be moved everyone that is not controllable.

Anyone have any suggestions? Thanks a lot!

What I want is to make an entity that can not be moved even by physics gun, and it is totally solid that nothing can pass it… Is there any function to do that?

hmm I guess you could try



MOVETYPE_FLY        = 4   -- Like no clip movement, but with collision.


Kinda sounds like what you want but im not sure what happens if you walk into or push it

Or you could try

**[PhysObj.Sleep

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=PhysObj.Sleep)**

So essentially you want it to be frozen in place.

**[PhysObj.EnableMotion

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=PhysObj.EnableMotion)**

This is probably what you’re looking for. It won’t be moved by anything but it will collide normally.

[editline]02:41PM[/editline]

Also you might have to use **[Gamemode.PhysgunPickup

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.PhysgunPickup)** to disable picking it up with the physics gun.

PhysObj.EnableMotion() is a good option as I actually want to touch a pillar by ENT:Touch() which is easily toppled down through operating a physics gun holding one thing to touch it. If I use PhysObj.Sleep(), that thing will be woken up and thus moved or toppled down. And for
[lua]self.Entity:SetMoveType(MOVETYPE_FLY)[/lua], it still becomes ‘transparent’ and can not be touched.

Thank you very much guys! How many days do you spend on these game??

I haven’t touched Garry’s Mod since mid-november. :smile:

It was the time that I began…