amo yeh Posted September 14, 2017 Share Posted September 14, 2017 I made a ragdoll experiment http://www.babylonjs-playground.com/#8PQK71 is it possible to add angle limit to make it more realistic? for example to make elbow bend forward only, and upper arm to bend up and down and foward only. also, the PointToPointJoint joint seems works better on cannon.js engine, (more like hip & thigh from my experiment) thanks for the help~ Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 14, 2017 Share Posted September 14, 2017 Hi! I'm no expert, but Oimo hinge joints have a limit motor. https://www.babylonjs-playground.com/#8PQK71#1 No major changes, but in line 145, I output hJointR2._physicsJoint... to console. Go to browser console and click on the word Object. Did an object inspector launch? If so, you can scroll-down through properties... and find limitMotor object. THAT object has angle, lowerLimit, upperLimit, assorted other crap. I don't know how to use those things, but I think that would be the area-of-interest. You might wish to do this same type of object-inspecting... with your point-to-point joints... see what adjustable things are on those, too. I have a badly-done Oimo API doc... here. http://urbanproductions.com/wingy/babylon/misc/j2h02.htm Do in-document search for public var limitMotor:LimitMotor; SECOND (2nd) hit is for hingeJoint. (1st hit is for prismatic). I THINK this is the way to set Oimo hingeJoint angle limits. Not sure about Cannon hinge joints. No promises, and sorry I don't have a playground demo to show. Love your raggy! Good luck. Others may comment soon. Although you CAN simply do... hJointR2._physicsJoint.limitMotor.upperLimit = [whatever], you may be allowed to use nativeParams feature, instead/too. In lines 158-161 of this playground, you can see some nativeParams being set for a joint. I'm not sure if it works, but you could try a native parameter of... limitMotor.upperLimit: 0.3, (an example). I have never tried using something.something within a nativeParams block, nor have I seen others do it. But maybe. Holler if you have questions or discoveries. Thx. amo yeh 1 Quote Link to comment Share on other sites More sharing options...
amo yeh Posted September 14, 2017 Author Share Posted September 14, 2017 Wow , that's a swift and useful response, thanks @Wingnut, will definitely dig into it and update if I learn something new. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 14, 2017 Share Posted September 14, 2017 My pleasure! You should also look at the OimoJSplugin object. Down near the bottom, there are some funcs... setMotor() and setLimit(). In fact, it might be wise to just do a playground search for 'motor'. There's also a thing... joint1 = new BABYLON.MotorEnabledJoint(BABYLON.PhysicsJoint.HingeJoint, jointData); *shrug* I found that... remarked-out... in some guy's messy demented experiments with lockJoints. A playground search for 'BABYLON.MotorEnabledJoint' returns 11 hits, so maybe you can figure how THAT is used. I think it is a shortcut... to avoid needing to call setMotor(). All these physics engines... have a BabylonJS layer, and a native layer. Both layers work great. The BJS layer is friendliest, but less powerful than native. Both layers sometimes require many experiments. Bye again. PS: If you come across playgrounds that say "setPhysicsState is not a function"... then that playground needs all its setPhysicsState() calls... converted to the NEW way... seen in the above working physics playgrounds. setPhysicsState() went deprecated about a year ago, and there are still many playgrounds that haven't been updated to the new way. Sorry for the inconvenience on that. Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 14, 2017 Share Posted September 14, 2017 Limits limits limits! Well, Wingnut's suggestions is the best suggestion, if youare planning on using motors. Those limits are for the motors, but not for the object itself. You can, however, set a min / max values to each joint which will limit it's functionality. Here is a quick example: http://www.babylonjs-playground.com/#8PQK71#2 Lines 129 and 150 are the interesting parts. amo yeh 1 Quote Link to comment Share on other sites More sharing options...
amo yeh Posted September 14, 2017 Author Share Posted September 14, 2017 I applied and it works as expected, Thanks for the help. a little demo update to simplify the function I was looking for http://www.babylonjs-playground.com/#8PQK71#3 Wingnut and RaananW 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 14, 2017 Share Posted September 14, 2017 Ah ha, there ya go. Thanks for the correction, @RaananW, and thanks for the new demos, guys. My apologies for sending you on a wild goose chase (telling you incorrect info), AY. I have lots to learn, yet. I need a better oimo api doc... or a better brain. hmm. Thx agn, guys. 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.