Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years 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
hellmatic 1523 Moderation Voter
6 years 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 607 — 6y
0
np hellmatic 1523 — 6y
Ad

Answer this question