zurcxer Posted April 7, 2014 Share Posted April 7, 2014 Hi Pandajs experts! I have this 2 bodies in a world. body1 is a rectangle.body2 is a circle. I also have a ground. I want to make these 2 bodies fall in the ground. Rectangle falls and hit the ground. But the circle continues to fall. this.world = new game.World(0, this.gravity);var groundBody = new game.Body({position: {x: game.system.width / 2, y: 750},collisionGroup: 0});var groundShape = new game.Rectangle(game.system.width, 100);groundBody.addShape(groundShape);this.world.addBody(groundBody);var x = game.system.width / 2;var y = 600;body = new game.Body({position: {x: x, y: y},velocityLimit: {x: 100, y: 1000},collideAgainst: 0,collisionGroup: 1,});var bodyShape = new game.Rectangle(200, 30);body.addShape(bodyShape);game.scene.world.addBody(body);body2 = new game.Body({position: {x: x, y: y},velocityLimit: {x: 100, y: 1000},collideAgainst: 0,collisionGroup: 1,});var bodyShape2 = new game.Circle();body2.addShape(bodyShape2);game.scene.world.addBody(body2);body.mass = 1;body2.mass = 1; Do you have any idea? Quote Link to comment Share on other sites More sharing options...
Apathy Posted April 7, 2014 Share Posted April 7, 2014 Your new game.Circle() has no radius value. use new game.Circle(radius) Quote Link to comment Share on other sites More sharing options...
zurcxer Posted April 8, 2014 Author Share Posted April 8, 2014 I think game.Circle class has a default of 50 as its radius. Even if I change it. It falls endlessly. Quote Link to comment Share on other sites More sharing options...
maho125 Posted April 13, 2014 Share Posted April 13, 2014 I think game.Circle class has a default of 50 as its radius. Even if I change it. It falls endlessly. I think that in engine is now missing solution of hitResponse for case when collide circle with rectangle. If you will look in physics module and you focus on class game.CollisionSolver (exactly hitResponse method on line 258) you will see that there is code for collision between two rectangle bodies and two circle bodies but missing for combination of rectangle and circle body and also for line body. So probably there is your problem I think. Quote Link to comment Share on other sites More sharing options...
enpu Posted April 13, 2014 Share Posted April 13, 2014 @maho125 you are absolutely right. Built in physics are still missing circle vs rect hit response.I would suggest to use p2 physics (as plugin), if your game needs more advanced physics. Quote Link to comment Share on other sites More sharing options...
maho125 Posted April 13, 2014 Share Posted April 13, 2014 @enpu I know. I had same problem as described above @rexternberg so I made some exploration in engine code and found reason where is the problem. I'm new in HTML5 gaming so now I'm trying some HTML5 engines and I have to say that your engine is my favourite for now. Very understandable code and nice examples. Great job! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.