Search the Community
Showing results for tags 'contact'.
-
Hello, I'm using Phaser with the Box2d Plugin. I'm having some issues with contact callbacks. I have a "wallContactCallback" to trigger when a body collides with any wall. This works correctly with any game that does not have a scrollable camera view. However, as soon as I set up a camera view, the callback is no longer triggered. Even though my bodies still collide with the walls, the callback still does not trigger. Has anybody seen an issue like this before? Any tips are appreciated. Thanks.
-
With javascript i do it such way: body.onBeginContact.add(method,this); function method(body, shapeA, shapeB, equation){ ..... } How can i do it with TypeScript?
- 1 reply
-
- phaser
- typescript
-
(and 2 more)
Tagged with:
-
Hi, this may be a stupid question, but I wasn't able to find anything on how to use a P2.Body as a trigger. Maybe it's my notion of "Trigger" that is wrong. I use this term because it's called like that in Unity. I mean here a body that sends a collision event but doesn't block anything. I know I could make a rectangle and check at each update if there's an object in it, but using the onBeginContact and onEndContact of P2.Body would seems more homogenous in my system. Thanks
-
I'm getting exception when I destroy a sprite on a collide. I'm detroying that sprite onEndContact of collision. Exception is: "this.sprite is null" on first line of "postUpdate" file. /** * Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished. * * @method Phaser.Physics.P2.Body#postUpdate * @protected */ postUpdate: function () { this.sprite.x = this.world.mpxi(this.data.position[0]); this.sprite.y = this.world.mpxi(this.data.position[1]); if (!this.fixedRotation) { this.sprite.rotation = this.data.angle; } },