Pryme8 Posted March 23, 2016 Share Posted March 23, 2016 http://www.babylonjs-playground.com/#U0HVA#9 I figured my code is right cause Im not dropping any errors... but effectively nothing happens if I change the joint to Hinge2Joint the sphere vanishes... Im kinda confused. trying to effectively replicate http://jsdo.it/pryme8/uTtJ Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 23, 2016 Share Posted March 23, 2016 http://www.babylonjs-playground.com/#U0HVA#11 (needed to get some motion in the ocean) You talking about line 85... changing to Hinge2Joint? Same symptoms here... HingeJoint fine, DistanceJoint fine, Hinge2Joint... sphere is gone (even with microgravity). Aren't I helpful? (yawn). Quite the contraption ya got built there, P8! Nice little? physics workbench jig. Well done! update: Ohhh, we need a cable, too? ooookay. http://www.babylonjs-playground.com/#U0HVA#12 update2: Ohhh, we need the scene to be totally ridiculous? ooookay. http://www.babylonjs-playground.com/#U0HVA#14 dbawel 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted March 23, 2016 Share Posted March 23, 2016 Great post and @Wingnut - nice example for the playground. With some simple adjustments, this can become an awesome machine to battle with in a game with simply changing a few parameters similar to the few adjustments I made below: http://www.babylonjs-playground.com/#U0HVA#15 It would be simple to create some simple machinery models to replace the cube and almost any geometry for the sphere to create an awesome machine to propogate a game environment with - especially if you randomize the rotations of the cube mesh - and even better - to change the behavior of the cube mesh based upon a character's proximity to the cube mesh to give it some percieved intellegence that would cause it to appear to recognize and to fight directly with a character in the game. I see the makings of an awesome adversary in a game. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 23, 2016 Author Share Posted March 23, 2016 that what the idea of structuring it like that. I have been mulling around how to make prefab game elements by just calling functions. btw wingnut, great fix! now how do we adjust the settings? and then im wondering why it disappears for every other joint, Id love to get them working so I can rig up some physic examples and then really build a vehicle object class.. ***EDIT*** Figured out how to change the type... now to edit some settings! Line 130 http://www.babylonjs-playground.com/#U0HVA#16 Figure some stuff out... http://www.babylonjs-playground.com/#U0HVA#17 **EDIT figured more out... after looking at https://github.com/BabylonJS/Babylon.js/blob/master/src/Physics/babylon.physicsJoint.ts max and min distances- maxDistance : 3, minDistance: 0, for a spring joint I guess I should be able to add length, stiffness, and dampening... but I assume thats handled by the spring in nativeParams also setting length effectively does nothing that I can see... but if you set it above 3 the joint freaks out! Wingnut 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 23, 2016 Share Posted March 23, 2016 So... A quick answer, as I don't have the full time to fully answer Each joint has its own fun parameters. Each joint has different constraints that are applied to the body. The distance joint changes only the body's position and not its rotation. therefore the anchors (might) change the parameters, but the axis isn't. Those are all optional parameters (in the code as well). From experience, if something simply vanishes, it means one of the parameters of the joint is wrong. And it is causing such a collision between two meshes, that the mesh vanished very quickly. Reduce the time step of the physics engine and you will see how it slowly vanishes. Of course, the parameters that fit a distance joint do not apply to a hinge2joint. They might be called the same, but they have a totally different purpose. That's like asking why when creating a sphere and a box with the same parameters, they don't look the same Only cannon has a spring joint, when you use spring joint in oimo it falls back to distance joint. There you can set stiffness, length, etc'. A quick demo is shown in the documentation page. Ah, and this is the link - http://doc.babylonjs.com/overviews/Using_The_Physics_Engine I finished writing the basic documentation for physics, and am about to write 2 more - advanced and joints tutorial. I am also about to finish a car-babylon class that might ease your understanding pain (thou I published most of the code already). I hope you will be patient enough. 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.