Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Is there any way to make an object collide only with objects I want?

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Ol1vver
Superfighter
Superfighter
Posts: 69
Joined: Mon Nov 19, 2018 4:55 pm
SFD Account: olv
SFD Alias: olv
Started SFD: PreAlpha 1.6.4
Gender:

Is there any way to make an object collide only with objects I want?

Post by Ol1vver » Tue Jan 01, 2019 11:34 pm

Hello,
Is it possible to make an object collide only with the objects I want?
For example:

I want an InvisibleBlock to only collide with players, but nothing else, and another one to collide with everything except players.
0 x

User avatar
Pricey
Superfighter
Superfighter
Posts: 399
Joined: Thu May 05, 2016 9:29 pm
SFD Alias: (LM) Pricey
Started SFD: August 2015
Location: United Kingdom
Gender:
Age: 22

Post by Pricey » Wed Jan 02, 2019 2:40 am

Use AlterCollision tiles.
0 x

User avatar
Ol1vver
Superfighter
Superfighter
Posts: 69
Joined: Mon Nov 19, 2018 4:55 pm
SFD Account: olv
SFD Alias: olv
Started SFD: PreAlpha 1.6.4
Gender:

Post by Ol1vver » Wed Jan 02, 2019 1:24 pm

Pricey wrote:
Wed Jan 02, 2019 2:40 am
Use AlterCollision tiles.
And how am I supposed to do that? Select all the objects in the entire map? And what about players only collision? smh
0 x

User avatar
Pricey
Superfighter
Superfighter
Posts: 399
Joined: Thu May 05, 2016 9:29 pm
SFD Alias: (LM) Pricey
Started SFD: August 2015
Location: United Kingdom
Gender:
Age: 22

Post by Pricey » Wed Jan 02, 2019 4:07 pm

Ol1vver wrote:
Wed Jan 02, 2019 1:24 pm
Pricey wrote:
Wed Jan 02, 2019 2:40 am
Use AlterCollision tiles.
And how am I supposed to do that? Select all the objects in the entire map? And what about players only collision? smh
You know you would really benefit from looking in the map editor yourself, there is literally a tutorial map AND a help section that answers this question for you.
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Wed Jan 02, 2019 5:41 pm

Use the IObject.GetCollisionFilter() and IObject.SetCollisionFilter(...) respectively as you need. This is advanced topic and you need to know how the Box2D engine works and operate with their categorybits and maskbits. You will also have to analyze which bits you need to change and how based on how you want the collision to be altered. SFD uses a lot of different collision categories for different purposes.

I recommend that you do not alter default collision behavior for any tile unless you have a very good reason to do so.
0 x
Gurt

Post Reply