ian Posted September 20, 2016 Share Posted September 20, 2016 If we have vertical bar and horizontal bar on top of vertical bar. and if we set joint like horizontalBar should rotate around Y (in blender around Z). If I push horizontalBar, two edges of horizontalBar is rotatin around Y but edges of horizontalBar are also swinging up and down (Z). When horizontal bar is rotationg edges are changing Y a little bit. Edges doesn't always have Y=3 like mainAxis have it. Can I lock hinge so that edges of horizontalBar will not swinging up and down and it will always rotate with same Y=3. Or I push too hard horizontalBar? Or is there any other/strange problem? Should edges of horizontal bar always rotate with same Y values (in this case Y=always 3)? var joint = new BABYLON.HingeJoint({ mainPivot: new BABYLON.Vector3(0, 0, 0), connectedPivot: new BABYLON.Vector3(0, 3, 0), mainAxis: new BABYLON.Vector3(0, 1, 0), connectedAxis: new BABYLON.Vector3(0, 1, 0) }); verticalBar.physicsImpostor.addJoint(horizontalBar.physicsImpostor, joint); Quote Link to comment Share on other sites More sharing options...
ian Posted September 21, 2016 Author Share Posted September 21, 2016 Ok here is example. When box fall down horizontalBar is moving Y-up Y-down. Can we lock horizontal so that when box fall on horizontalBar, horizontal bar will not move down and up by Y-axis? http://www.babylonjs-playground.com/#1UF7BM#7 greetings, ian Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 22, 2016 Share Posted September 22, 2016 Hi Ian. I don't think there is a way to stop that. Remember the train wheel demo? Remember me saying I have tried to remove wheel "wobble" and failed? *nod*. Same problem... too much mass... landing on leverage point of fulcrum. Joints have some "slop"... and I have searched for ways to "tighten the bearings". I did not find a solve. With box mass much lower... http://www.babylonjs-playground.com/#1UF7BM#8 Better. Still some "bounce"... caused by hinge slop. Sorry I have no happy answer. Perhaps others will have ideas. Box falling through floor, too. Darn. *scratch scratch* ian 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 23, 2016 Share Posted September 23, 2016 I have one more "bad idea". You could drop another physics-active box, same mass... on opposite side of the fulcrum. It could be invisible. A counterweight. http://www.babylonjs-playground.com/#1UF7BM#9 ian 1 Quote Link to comment Share on other sites More sharing options...
ian Posted September 23, 2016 Author Share Posted September 23, 2016 Thank you. for your response. Ok so joint works, and there is no way to lock horizontal bar. OK then. So this is how join must works. We should do with parent-child and lock horizontal pivot probably. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 23, 2016 Share Posted September 23, 2016 Well, there are ways to lock the bar... but... you were looking for native Cannon API calls to do it. There is also foolery. Use a timer... and fake gravity on the box. Start with no physics on bar and box. Add a call in scene.registerBeforeRender to moveBoxDownSmallAmount()... check for intersect of box and bar. When intersecting, scene.unregisterBeforeRender moveBox...(). THEN... turn-ON physics state for bar and box. The box will not be doing a physics fall. It will be doing a "physics fall simulation" Just another idea, probably not good. ------------------- Another idea: Using renderLoop... constantly monitor bar.body.angularVelocity... see if bar tilt is happening. If found, null/zero it. Perhaps only for short time... then remove that angularVelocity-checker from renderLoop. Keep experimenting. ian 1 Quote Link to comment Share on other sites More sharing options...
ian Posted September 23, 2016 Author Share Posted September 23, 2016 good hint I'll try some this things. Maybe intersection checking and render bar rotation.. thank you Wingnut Wingnut 1 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.