Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

Collision Filtering: How can I let a collision group uncollidable with itself?

Asked by 8 months ago

This script is inside a part

--SERVICES
local PhysicsService = game:GetService('PhysicsService')

--VARIABLES
local Part = script.Parent

--CREATE COLLISION
local PartGroup = "PartGroup"

PhysicsService:CreateCollisionGroup(PartGroup)

1 answer

Log in to vote
1
Answered by 8 months ago

You can only create 'PartGroup' once. If the group already exists, the output would return a error.

Create a separate script that creates collision groups:

--CREATE COLLISION
local PhysicsService = game:GetService('PhysicsService')
local PartGroup = "PartGroup"

PhysicsService:CreateCollisionGroup(PartGroup)

PhysicsService:CollisionGroupSetCollidable(PartGroup, PartGroup, false) -- sets the group uncollidable with itself

Part script:

--SERVICES
local PhysicsService = game:GetService('PhysicsService')

--VARIABLES
local Part = script.Parent

PhysicsService:SetPartCollisionGroup(Part, 'PartGroup') -- requires a part and the name of the collision group
1
it worked thanks awesomeipod 562 — 8mo
0
np unsatisfie_d 1211 — 8mo
Ad

Answer this question