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
Fighter
Fighter
Posts: 32
Joined: Mon Nov 19, 2018 4:55 pm
SFD Alias: Ol1vver
Started SFD: PreAlpha 1.6
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
Why are you reading my signature?

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

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

Use AlterCollision tiles.
0 x
very nice władysław iii jagellion-chan

User avatar
Ol1vver
Fighter
Fighter
Posts: 32
Joined: Mon Nov 19, 2018 4:55 pm
SFD Alias: Ol1vver
Started SFD: PreAlpha 1.6
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
Why are you reading my signature?

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

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
very nice władysław iii jagellion-chan

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

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