Disabling collisions: worth it?

For questions about using Classic.

Post » Wed May 20, 2009 8:26 pm

Is it worth it to set collisions to none for objects which never collide with anything (ie.particle sprites)? Even if there are no collision checking events, does it still use cpu time? If so, how much? Is it a negligible difference for say.. 300-500 objects?
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed May 20, 2009 8:40 pm

Hmm, not sure.

For physics, I think the answer is definitely yes.

For other behaviors, I don't really know. It's not like the behavior knows whether or not you've put stuff into the game to collide with, so it's got to check for collisions. The question is, are the behaviors smart enough to skip that if you've selected "None" as the collision type? I suppose only a dev could answer that one, otherwise you could do some tests on your own.

As for moving your own sprites around without behaviors, I'm pretty sure the only time they're checking for collision is when you tell them to in events, so it wouldn't really matter if you're not colliding them with anything.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed May 20, 2009 9:14 pm

I've done this, expecting it would be faster.
I have an object that expels a jet of sprites with physics enabled and collisions disabled. They die after a second.

It's kind of a zen question: if there is no collision mask, is there a collision check?
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed May 20, 2009 9:57 pm

If no plugins, behaviors or events check for collisions on an object, then there are no collision checks on that object. Therefore, setting the collision mode to 'none' has no effect. What would be the point of checking collisions for an object that doesn't need them anyway?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu May 21, 2009 4:07 pm

So, for example, when you untick bounce off solids with the ball behavior, It stops checking for collisions completely right?
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Thu May 21, 2009 4:16 pm

Yes.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests