Jump to content

Which Physics System To Chose ?


valueerror
 Share

Recommended Posts

so i checked the latest commits and saw that there are now 3 physics systems available and 2 more to come..  wow..  i'm a little bit overwhelmed because i just learned phaser1.1.x and it seemed so easy to understand.. now i'm unsure what to do...

 

therefore i have some questions:

 

1) if i want to make a typical platformer game with slanted, round, triangle or square tiles i guess i would use ninja for the physics between my objects and the tilemap - wrong?

2) if i also love the possibilities of p2 materials and i want to apply specific material options to one of my gameworld layers?  am i able to do so?  combine p2 materials with a ninja tilemap collision handler?

2.2)  how do i apply something to a layer..  do i really have to circle through every single tile in the tilemap somehow or can't i just say.. layer.setMaterial() ? (i hope there is/willbe a function for that)

3) if i also want very specific collisionProcessHandler (jump through from below but land on platforms for example) can i do this with ninja or do i need to apply arcade physics to this tilemap layer then?

4) if i want to shoot my enemies and need a very simple arcade collisionCallback and also a specific collisionProcesshandler (if invisible do not collide but fly through) AND i want this enemy to collide with my tilemap tiles in a ninja way..  would this be possible?

 

so all in all one question could sum it up:

5) am i supposed to chose A single physics system or are they interoperable ?

6) which physics systems are a good idea to use together and which ones are a very bad idea?

7) is sounds like a performance drop is inevitable when using p2 and ninja and arcade alltogehther -wrong?

 

 

big thx for every answer!

Link to comment
Share on other sites

ad 1, 4,5,6,7)  >> answered in rich's post..    thank you very much!

 

ad 3)

you can do this with ninja if you want to:

game.physics.ninja.collide(player, enemyTiles, playerDie, customHandler, this);

BUT if you decide to use p2 there is no customProcessHandler right now - it seems..  :(   

 

 

ad 2) it seems you cant :(

bodies can only belong to ONE physicssystem.. so you can either use ninja for collision or p2 for materials  - you can not let ninja handle the collision and set p2 materials to the same tiles (bodies)

 

so it looks like i have to initialize the "ice" layer (where i want my player to slide over anything there) with p2 (if that's possible) but then my player (who resides in the ninja physics system would not collide with it..  am i right?  

 

new questions arise ^^

 

8) so if i want to use materials somewhere in my game i should stick mainly to p2 ??    

9)  how to initialize a tilemap in the p2 system so it collides with my playerCollisiongroup  - is there already an example to look at?

10)  is there a way to define a customProcessHandler in p2 like you can do in arcade or ninja ?

 

thx rich..  phaser is getting more complex but very powerful..  !! :D

Link to comment
Share on other sites

To be honest anything Ninja can do, p2 can do as well! So if you can get away with using just p2, I would definitely do so and keep your life simple.

 

8) Materials are for p2 only, which is why they are now named under Phaser.Physics.P2.Material, to avoid confusion.

 

9) I need to fix my example project that does this, but basically it's quite simple :) There is a new function you call that generates p2 bodies for colliding tiles. There's also another that generates p2 bodies for Tiled polylines, so you can 'draw' a set of collision polys in Tiled instead of using tile indexes too.

 

It's really not getting more complex, it's just getting more options. But I guess that is the same thing in a way :) I think with more tutorials and docs, and examples, it will be less of a head scratch.

Link to comment
Share on other sites

haha.. yes ...  i scratch my head often in the last days but it's my own fault..  i have to train myself in patience and stop hacking and trying and wasting your time with questions that will be answered once your done with everything..  

 

 

ad 9) polyines sound great ..    i already was wondering if i could use the object layer in "tiled" somehow to autoMAGICally create hills and slides and so on....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...