mcfly

Members
  • Content Count

    2
  • Joined

  • Last visited

  • Days Won

    1
  1. @ivan.popelyshev, I understand that PIXI is used for rendering only. I don't expect it to have built-in physics methods. I was trying to understand if I'm doing something wrong, as I'm sure a lot of people has encountered the same problem. Thank you for your detailed explanation. I'll definitely wait for the article you've mentioned. @bubamara, thank you too for your suggestion. I'll try to work something out of both your suggestions.
  2. Hi all, I'm new to Pixi.js, so excuse me, if the answer to my question is obvious. I'm building a 2d platformer where I have a PIXI.Container which contains a few sprites (let say player's arm, body, head etc.). Based on the user input I'm moving the whole container (not each sprite individually). I also have container which contains all platforms of the level (they are all of type PIXI.Spirte). I want to detect when the player's container intersects with any of the platforms and stop the container from moving forward (the usual stuff). Currently I'm using the Bump.js library (https://github.com/kittykatattack/bump). But I'm encountering few problems. First of all Bump.js doesn't work for 'container vs array with sprites' type of collision, so I've tried to detect an intersection between each player's sprite against the array with platforms. Basically I'm using the following: player.move(); // move the player's container to any direction BUMP.hit(playersArm, platformsArray, true, false, true); BUMP.hit(playersBody, platformsArray, true, false, true); BUMP.hit(playersHead, platformsArray, true, false, true); This is testing for intersection between each player's sprite and stops it from moving, if there is a collision. All this is working fine and if there is an intersection the intersecting player's sprite position will be set to a value that is not intersecting with the platforms. However all the other sprites will continue moving, as they are not yet intersecting with the platforms. Hope I expressed myself clear. Have you ever had such problem and how did you solve it? I can only think of building a custom collision detection logic which works with 'container vs array with sprites', so I don't have to care for each player's sprite individually, but work with the container. Do you know of any library that already handled such cases? Or maybe I've been wrong from the start by taking such approach (having player's container with several sprites in it)? Thank you in advance.