gauravD 7 Posted January 16, 2018 Report Share Posted January 16, 2018 Hi. Prismatic and Spring joints in p2js seem pretty straightforward. I was wondering why using constant rest length, stiffness and damping for a spring would change its behavior when a body's local anchor is changed. Fiddle: http://jsfiddle.net/gauravdixitv/83bkhr3f/ (phaser/p2js template from inkfood) From the fiddle, all the springs use share the same parameters except the local anchor of body A. Why do the springs behave differently? :/ Quote Link to post Share on other sites
schteppe 15 Posted January 17, 2018 Report Share Posted January 17, 2018 I tried removing all prismatic constraints from your demo and it still looks weird. The wheels are pulled to the left by some force. I haven't seen this in the p2.js library before, so for now I think there is a bug is in the Phaser P2 plugin? Edit: Oh wait. I think it might just be the buggy rendering of springs? Quote Link to post Share on other sites
gauravD 7 Posted January 18, 2018 Author Report Share Posted January 18, 2018 You are right - works flawlessly in p2.js - http://www.physicstoy.com/383# Seems like the Phaser P2 plugin then. Will investigate some more today and get back to you! Quote Link to post Share on other sites
gauravD 7 Posted January 18, 2018 Author Report Share Posted January 18, 2018 Okay. Fixed. http://jsfiddle.net/gauravdixitv/6acmp7h5/ Turns out Phaser uses physics.p2.pxmi (pxm inverse) to anchor a prismatic joint - https://github.com/photonstorm/phaser-ce/blob/master/src/physics/p2/PrismaticConstraint.js#L39 BUT, physics.p2.pxm to anchor a linear spring - https://github.com/photonstorm/phaser-ce/blob/master/src/physics/p2/Spring.js#L59 What is up with this ? Quote Link to post Share on other sites
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.