D
D
Dmitry2015-07-29 11:23:11
JavaScript
Dmitry, 2015-07-29 11:23:11

How to add collision handling to Pixi.js?

Made animation on Canvas using Pixi.js. I really enjoyed working with him. Almost everything is intuitive. I made an animation, everything is spinning, spinning. But now the task is to process several collisions. But in Pixi this doesn't seem to be the case... I don't want to use and learn another framework :) I watched Phaser, but it's very huge and not intuitive... I decided to bypass it. What do you advise? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2015-07-29
@k12th

Of course not, it's purely a graphics engine. And for physics you need a physical one .

D
Dmitry, 2015-08-05
@Dit81

Wrote a function just to detect rectangle-rectangle collisions. Solve problems! ))

function checkForCollision(obj1, obj2){
if ((obj1.x < obj2.x + obj2.width) && (obj2.x < obj1.x + obj1.width) && (obj1.y < obj2.y + obj2.height) && (obj2.y < obj1.y + obj1.height)) return true;
return false;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question