Making an entity no collide with bullets, but still collide with the world
4 replies, posted
I'm working on an SNPC which has the ability to turn visible/invisible. I wanted to make it so that the entity cannot be shot (which gives away its position) when it is in its invisible state. Since the entity jumps around the map, I need to still make it collide with the world (and preferably ONLY the world), so that it can push itself out if it's stuck anywhere. I've only managed to get it not collide with bullets anymore. COLLISION_GROUP_DEBRIS advertises itself as only colliding with the world, but so far in my tests that hasn't been true. Any ideas?
local physobj = self:GetPhysicsObject()
if self:GetTransparency() < self.HitAbleTransparency then
self:SetCollisionGroup(COLLISION_GROUP_NONE)
physobj:SetVelocity(Vector(0,0,0))
physobj:Sleep()
self:SetNotSolid(true)
else
self:SetNotSolid(false)
physobj:Wake()
physobj:SetVelocity(Vector(0,0,-128))
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
end
What else does COLLISION_GROUP_DEBRIS collide with? Does COLLISION_GROUP_WORLD any better?
if I remember correctly, COLLISION_GROUP_DEBRIS and COLLISION_GROUP_DEBRIS_TRIGGER don't collide with bullets but can react when shot.
try COLLISION_GROUP_DISSOLVING. This might give you some weird results though.
None of these worked sadly :/
https://files.facepunch.com/forum/upload/113610/0611f9ec-d6cf-4a34-9e68-9bbf4806994e/image.png
Seems the only thing that works is SetNotSolid, meaning the collision groups don't affect this entity (not even COLLISION_GROUP_NONE). I'm certain it's because I rebuild the entity's collision bounds and use PhysicsInitSphere when it's spawned, though I don't understand why these would break the collision groups.
Would ENTITY/ImpactTrace help you to hide the effects?
Sorry, you need to Log In to post a reply to this thread.