I used this to create box collision for my entity:
shared.lua
[lua]
function ENT:Initialize()
self:SetModel("models/props_c17/chair02a.mdl")
local min = Vector(0,0,0)
local max = Vector(50,100,50)
self:PhysicsInitBox(min,max)
self:SetCollisionBounds(min,max)
self:PhysWake()
end
[/lua]
But the collision does not rotate with the entity no matter how much I rotate it.
It does collide with physics, but stops players and traces in thin air.
How to make simple box collision that does rotate with entity?
If I remember correctly, you have to [url=http://wiki.garrysmod.com/page/Entity/EnableCustomCollisions]enable custom collisions[/url] on an entity if you're going to give it a custom physics model.
[QUOTE=_Kilburn;40288782]If I remember correctly, you have to [url=http://wiki.garrysmod.com/page/Entity/EnableCustomCollisions]enable custom collisions[/url] on an entity if you're going to give it a custom physics model.[/QUOTE]
Bullets can hit it now, however collision bound is still same.
Maybe a think would update it like this:
[lua]
function ENT:Think()
local min = Vector(0,0,0)
local max = Vector(50,100,50)
-- Rotate min and max.
self:SetCollisionBounds(min,max)
end
[/lua]
But I have no idea how to rotate a vector.
Sorry, you need to Log In to post a reply to this thread.