gauravD Posted January 16, 2018 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? :/ Link to comment Share on other sites More sharing options...
schteppe Posted January 17, 2018 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? Link to comment Share on other sites More sharing options...
gauravD Posted January 18, 2018 Author 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! Link to comment Share on other sites More sharing options...
gauravD Posted January 18, 2018 Author 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 ? Link to comment Share on other sites More sharing options...
Recommended Posts