Maxime Posted May 18, 2014 Share Posted May 18, 2014 HI everyone, I have sprites that have their own trajectory in the world.They have to move like this no matter what happened.But with P2 collision when my player collide with them they are deviated, player move them. I can't make them static because they are moving.I want the player be deviated by them but not the other way round. Is it even possible?And if yes how? Thanks. Link to comment Share on other sites More sharing options...
valueerror Posted May 18, 2014 Share Posted May 18, 2014 its not a hundred percent but if you give the object a very big mass and the other objects very small masses it should work.. Link to comment Share on other sites More sharing options...
Maxime Posted May 18, 2014 Author Share Posted May 18, 2014 Yes it woork.I put 9999 on the sprites and 1 on my player. DIdn't thought about dealing with mass to resolve my issue.Thanks. Link to comment Share on other sites More sharing options...
Zef Posted May 18, 2014 Share Posted May 18, 2014 Hi, a cleaner way to do this would be to set the sprites body to kinematic:sprite.body.kinematic = true;This means the sprite is not effected by collisions but is still expected to move and will fire collision events jpdev and valueerror 2 Link to comment Share on other sites More sharing options...
valueerror Posted May 19, 2014 Share Posted May 19, 2014 well .. masses work.. after all its a physics simulation.. but kinematic is the better solution to this problem... it's made for that! a kinematic body will also ignore gravity for example Link to comment Share on other sites More sharing options...
Maxime Posted May 19, 2014 Author Share Posted May 19, 2014 Nice thanks.I was wondering what kinematic is.I'll try this at noon. Link to comment Share on other sites More sharing options...
Maxime Posted May 19, 2014 Author Share Posted May 19, 2014 Great it's working, and in a much clearer way. Link to comment Share on other sites More sharing options...
Recommended Posts