khleug35 Posted November 11, 2018 Share Posted November 11, 2018 I would like to create slopes platform and make the player stand on it I use rotation method, it is work on sprite , but not work in body.......any idea, thank you very much game.addAsset('sprite.png'); game.createScene('Main', { init: function() { this.sprite = new game.Sprite('sprite.png'); this.sprite.anchor.set(50, 50); this.sprite.position.set(game.width / 2, game.height / 2); this.sprite.addTo(this.stage); var shape = new game.Rectangle(); shape.width = this.sprite.width; shape.height = this.sprite.height-20; this.body.addShape(shape); this.body.addTo(game.scene.world); }, update: function() { this.sprite.position.copy(this.body.position); this.sprite.rotation = 0.4; this.body.rotation = 0.4; // not work } }); Wolfsbane 1 Quote Link to comment Share on other sites More sharing options...
enpu Posted November 13, 2018 Share Posted November 13, 2018 Unfortunately the built-in physics engine doesn't support rotated bodies. For more advanced physics, i would suggest to use p2.js plugin: https://www.panda2.io/plugins#p2 Wolfsbane and khleug35 2 Quote Link to comment Share on other sites More sharing options...
khleug35 Posted November 14, 2018 Author Share Posted November 14, 2018 18 hours ago, enpu said: Unfortunately the built-in physics engine doesn't support rotated bodies. For more advanced physics, i would suggest to use p2.js plugin: https://www.panda2.io/plugins#p2 @enpu ok, thank you for your help, cheer 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.