Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by dungeonmaster

I have an entityFish.

I have a number of players and each of them spawn multiple instances of fishes.

With the additional property .owner, game knows whose fish is that.

What I want is, to only collide the entityFish if the owner is some other one.

In other words, the fish with the same owner shouldn't collide with each other but collide with every other fish in the scene.

I thought I need to overwrite ig.Entity.checkPair but it's declared different then other methods in ig.Entity (static???).

Any ideas how to make this thing work?

1 decade ago by StuartTresadern

Take a look at this thread
http://impactjs.com/forums/code/entitytype-plugin

I think the plugin may do what you want .

1 decade ago by dungeonmaster

Thanks for the answer. I liked the type.A type.B notion and it's bitwise check in the engine so will opt-out of that plugin solution.

However for anyone interested, I found in the engine code that the types actually aren't limited to A and B. For example:

entity1.type = 1 //ig.entity.TYPE.A
entity2.type = 4 //no default definition
entity3.checkAgainst = 5 //1+4: bitwise summation inreality

then the .check() of the entity 3 is called if it collides with entity 1 or 2.

types can be 2^n : 1,2,4,8,16,..
just add the types of checkagainst in your code.
Page 1 of 1
« first « previous next › last »