Search the Community
Showing results for tags 'panda.js tween collision'.
-
Hi there, Todat I was doing some testings in panda.js and I encountered something strange. It appears that collision between two bodies is not detected upon shifting a body with a tween. In contrast: When I move one of the bodies, the collisiondetection works fine). Here is my code example: game.module( 'game.main').body(function() { game.addAsset('box.png'); Box = game.Class.extend({ init: function(x, y, speed) { //container for graphics this.container = new game.Container(); this.container.addTo(game.scene.stage); //link to scene to get the update() function of this object running. game.scene.addObject(this); //sprite this.sprite = new game.Sprite('box.png',0,0,{anchor: { x: 0.5, y: 0.5 }}); this.sprite.addTo(this.container); //body this.body = new game.Body({ position: { x: x, y: y }, collisionGroup: 0, collideAgainst: 0, mass: 0, }); this.body.collide = this.collide.bind(this); this.body.addShape(new game.Rectangle(136, 176)); game.scene.world.addBody(this.body); }, collide: function() { console.log("Collision. This line is not called."); return true; }, update: function(){ this.sprite.position.x = this.body.position.x; this.sprite.position.y = this.body.position.y; }, remove: function() { game.scene.removeObject(this); game.scene.world.removeBody(this.body); this.container.remove(); }, }); game.createScene('Main', { backgroundColor: 0x44cce2, init: function() { this.world = new game.World(0, this.gravity); this.box=new Box(100,500,0); this.box2=new Box(500,500, 0); game.scene.addTween(this.box2.body.position, {x: -100}, 300, {repeat: Infinity, yoyo: true}).start(); }, });});Has anyone experienced this too? Is this a bug or should I just use movement in stead? Suggestions are welcome. cheers, Stephan