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 7 years ago

This script is inside a part

01--SERVICES
02local PhysicsService = game:GetService('PhysicsService')
03 
04--VARIABLES
05local Part = script.Parent
06 
07--CREATE COLLISION
08local PartGroup = "PartGroup"
09 
10PhysicsService:CreateCollisionGroup(PartGroup)

1 answer

Log in to vote
1
Answered by
hellmatic 1523 Moderation Voter
7 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:

1--CREATE COLLISION
2local PhysicsService = game:GetService('PhysicsService')
3local PartGroup = "PartGroup"
4 
5PhysicsService:CreateCollisionGroup(PartGroup)
6 
7PhysicsService:CollisionGroupSetCollidable(PartGroup, PartGroup, false) -- sets the group uncollidable with itself

Part script:

1--SERVICES
2local PhysicsService = game:GetService('PhysicsService')
3 
4--VARIABLES
5local Part = script.Parent
6 
7PhysicsService:SetPartCollisionGroup(Part, 'PartGroup') -- requires a part and the name of the collision group
1
it worked thanks awesomeipod 607 — 7y
0
np hellmatic 1523 — 7y
Ad

Answer this question