hamdirizal Posted March 24, 2015 Share Posted March 24, 2015 Hi. All, I have this script (use debugdraw to see the shape). When I use Panda 1.12.0 it is working properly. But when I switch to Panda 1.13.1 the collision functions are not called. Is this bug or something? Thanks.game.module( 'game.main').body(function() {game.createScene('Main', { init: function() { this.world = new game.World(0, 100); var f=new game.Food(); var m=new game.Monster(); }});game.createClass('Food', { init: function() { this.radius=9; this.body = new game.Body({ position: { x: 320/2, y: 100 }, velocityLimit: { x: 300, y: 800 }, mass:1, collisionGroup: 1, collideAgainst: [0] }); this.body.velocity.y=-100; this.body.collide = this.collide.bind(this); var shape=new game.Circle(this.radius); this.body.addShape(shape); game.scene.world.addBody(this.body); game.scene.addObject(this); console.log(this.body) },//end Init() collide:function(opponent){ console.log('Collision! On food') }});//End Class 'Food'game.createClass('Monster', { init: function() { this.radius=15; this.body = new game.Body({ position: { x: 320/2, y: 300 }, velocityLimit: { x: 0, y: 0 }, collisionGroup: 0, collideAgainst: [1] }); this.body.collide = this.collide.bind(this); var shape=new game.Circle(this.radius); var rshape=new game.Rectangle(40,40); this.body.addShape(rshape); game.scene.world.addBody(this.body); game.scene.addObject(this); console.log(this.body) },//end Init() collide:function(opponent){ console.log('Collision!') }});//End Class 'Monster'});//End bodyPS: Sorry for my english. Quote Link to comment Share on other sites More sharing options...
enpu Posted March 24, 2015 Share Posted March 24, 2015 Copy CollisionSolver class from here into physics.js and try if it works:https://github.com/ekelokorpi/panda.js-engine/blob/develop/src/engine/physics.js Quote Link to comment Share on other sites More sharing options...
hamdirizal Posted March 25, 2015 Author Share Posted March 25, 2015 Thanks enpu. It works now. 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.