powroupi / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.82k stars 277 forks source link

adding and editing physics #151

Open Hogarth-MMD opened 6 years ago

Hogarth-MMD commented 6 years ago

If I add or edit physics, then [Build] physics, the correct physics animation does not happen. The joints do not move along with the rigid bodies. After editing physics settings there is no updating of bone constraints or parent-child relations.

Hogarth-MMD commented 6 years ago

Feature request: Saving presets of physics settings. Copying settings of rigid bodies or joints to physics presets.

powroupi commented 6 years ago

The joints do not move along with the rigid bodies.

The joints would not move, they just provide the initial positions and axes, but the simulation should be correct.

After editing physics settings there is no updating of bone constraints or parent-child relations.

You need to click [Build] to re-build physics to update the settings, and it is better to click [Clean] before changing MMD physics settings.

Saving presets of physics settings. Copying settings of rigid bodies or joints to physics presets.

I don't understand this. Do you mean something like CSV feature?

Hogarth-MMD commented 6 years ago

I don't understand this. Do you mean something like CSV feature?

No, I don't mean CSV feature. In the dialog box which appears, when you add a rigid body or joint, you can save a preset, but the preset does not include all of the physics settings.

Hogarth-MMD commented 6 years ago

I have been trying to add physics to a bone chain and then make a simple pendulum animation, but the results are full of errors. I request that @powroupi test and debug this.

Hogarth-MMD commented 6 years ago

When I build or clean physics, does it matter which object is the active object?

Hogarth-MMD commented 6 years ago

I am trying to add physics to a bone chain, then make a key frame pendulum animation of the top bone. The top bone has the bone physics setting. The other bones have bone + physics setting. The bones other than the top bone should shake and swing when I press play.

Hogarth-MMD commented 6 years ago

Is there any problem if I mass add joints to many rigid bodies at the same time?

powroupi commented 6 years ago

In the dialog box which appears, when you add a rigid body or joint, you can save a preset, but the preset does not include all of the physics settings.

Okay, I've added all of the physics settings in commit b3b84c8.

When I build or clean physics, does it matter which object is the active object?

Yes, it only build "acitve MMD model" (depends on which MMD model the active object belongs to).

I am trying to add physics to a bone chain, then make a key frame pendulum animation of the top bone....

I don't see any problems. Maybe try tweeking physics settings, like "Linear/Angular Damping" of rigid bodies, and "Lower/Upper Limits" of joints.

Is there any problem if I mass add joints to many rigid bodies at the same time?

The joints will only be added to coresponding bone joints when you selected many rigid bodies. So it is very easy to add rigid bodies and joints to a bone chain. :)

Hogarth-MMD commented 6 years ago

BTW, I have started to receive github notifications of pull requests, in addition to being notified about comments in issues. No notification of commits by @powroupi though.

Hogarth-MMD commented 6 years ago

What about building or cleaning physics before and/or after inserting key frames? I am wondering if there may be an mmd_tools bug related to this order of operations. What is the correct order of operations?

Hogarth-MMD commented 6 years ago

When are shadow and dummy bones created? Are they created when importing an MMD model into Blender? Are they created when building physics? If I have created the model in Blender, will it possibly have an animation problem related to shadow and dummy bones?

Hogarth-MMD commented 6 years ago

Hello @powroupi! Okay, my latest attempt at making a physics animation was successful. One problem I had was needing to adjust the caching settings to more frames and bake the physics animation. I don't know if mmd_tools can make this more user-friendly for the average person(?). Can you please change the default settings for rigid bodies? The linear and angular damping should be 0.5 - 0.75. Then the user can have a fun time from the beginning instead of experiencing frustration and wasted time.

Hogarth-MMD commented 6 years ago

"Okay, I've added all of the physics settings in commit b3b84c8."

Thank you, @powroupi, for your hard work and for this excellent new feature! :heart: Can you please also add a feature to copy the settings from a rigid body or joint into a preset? This can be a good time-saving feature.

Hogarth-MMD commented 6 years ago

Hello @powroupi ! In addition to copying settings from a rigid body or joint into a preset, can you please make 2 new buttons which can apply a preset onto all selected rigid bodies or onto all selected joints? For this you can use almost exactly the same 2 dialog boxes which are being used for add rigid body and add joint.

nagadomi commented 6 years ago

In addition to copying settings from a rigid body or joint into a preset, can you please make 2 new buttons which can apply a preset onto all selected rigid bodies or onto all selected joints? For this you can use almost exactly the same 2 dialog boxes which are being used for add rigid body and add joint.

Blender has that feature. 3D View -> Tool Shelf -> Physics Tab- > Rigid Body Tools -> Copy from active (Copy Rigidbody setting from active to selected) Also, to change the property of multiple selected objects to the same value, hold down ALT and click the property and then change the value.

Hogarth-MMD commented 6 years ago

Thanks @nagadomi . I guess that would work for animation in Blender, but not for exporting to pmx.

powroupi commented 6 years ago

We can add operator for copying rigidbody/joint settings from active to selected, but some properties will be skipped, like name_j, name_e, rigidbody's target bone, joint's 2 target objects.

Copying settings of rigid bodies or joints to physics presets.

Do you mean changing the settings/parameters of AddRigidBody/AddJoint operator dialog? You can load settings from presets you saved, but I'm not sure if it is possible to load settings from selected rigidbody/joint or add into presets directly. :cry:

Hogarth-MMD commented 6 years ago

If someone has a model which has excellent physics settings., he wants to copy those settings into physics presets quickly and easily. Then if he is editing a different model which has lousy physics or no physics, he can quickly and easily apply the settings from his collection of physics presets onto rigid bodies or joints of this other model. This is what I am hoping for. This would be a nice time-saver when editing or adding physics.

powroupi commented 6 years ago

if he is editing a different model which has lousy physics or no physics, he can quickly and easily apply the settings from his collection of physics presets onto rigid bodies or joints of this other model.

Understood, but I'm sorry I don't have any idea to implement it, I need to know the exact steps which can be made for automation. :sob:

Maybe you can try import [Armature+Physics] parts of the model which has excellent physics settings, remove unwanted bones and rigidbodies/joints, then you can export it to PMX file (presets) which has only excellent physics you want, so you can merge it to different models. (not sure if there is any issues, though) :sweat_smile:

Hogarth-MMD commented 6 years ago

Can you not implement it with an additional 2 dialog boxes for rigid bodies and an additional 2 dialog boxes for joints? You need these additional dialog boxes, but the preset classes and preset values will be exactly the same as the preset classes and preset values of the add joint dialog box and the add rigid bodies dialog box.

Hogarth-MMD commented 6 years ago

Exactly the same properties will be used in all 3 rigid body dialog boxes, but these properties will be used differently by 3 different operator buttons. Exactly the same properties will be used in all 3 joint dialog boxes, but these properties will be used differently by 3 different operator buttons.