All Classes Namespaces Functions Variables Enumerations Properties Pages
Props

PuppetMaster includes a helpful tool for attaching, detatching and managing physical props - the PropMuscle and PuppetMasterProp classes. PropMuscle is a special type of muscle that the PuppetMasterProp objects can be attached to. For an example of prop usage, please see the "Prop" and "Melee" demo scenes.


Getting Started:


Prop Setup:

Because of the dual rig structure, the prop needs to be set up so that its root GameObject is the Muscle with the Rigidbody and ConfigurableJoint components and parented to it the Target along with its mesh and renderer(s). When the prop is picked up, the prop will be split up so that the "Mesh Root" will be parented to the Target root hierarchy and the rest of the prop with colliders to the Prop Muscle. When the prop is dropped, original hierarchy will be restored.

When the prop is picked up, the Rigidbody component on it will be destroyed as the PropMuscle already has a Rigidbody. The colliders of the prop will act as compound colliders for the PropMuscle Rigidbody. When the prop is dropped, the original Rigidbody will be restored.

Prop.png
PropScene.png


PropMuscle component:

PropMuscle is a special type of muscle, which all prop objects can be attached to. You can create a PropMuscle in the Editor by selecting the PuppetMaster GameObject and clicking on "Add Prop Muscle" on the bottom of the PuppetMaster component. Click on the blue button in the scene representing the PropMuscle and move/rotate it to where you need it to be. If your puppet does not have hand muscles and the PropMuscle was attached to the forearm muscle, find the Prop Muscle Target GameObject in the Target Root hierarchy and parent it to the hand bone.

PropMuscle.png

Picking up, dropping and switching props with the PropMuscle is done by simply changing the propMuscle.currentProp value. When you assign a prop to it by propMuscle.currentProp = myProp, any props held by the PropMuscle will be dropped and the new myProp will be attached instead. If you set currentProp to null, any props held by the PropMuscle will be dropped and the PropMuscle itself deactivated.

// Dropping props
propMuscle.currentProp = null;
// Dropping any props held, picking up myProp
propMuscle.currentProp = myProp;

When a prop is attached to the PropMuscle, its localPosition and localRotation are set to zero/identity, so the best practice to adjust prop holding pivot would be to parent the prop to the PropMuscle, set localPosition/Rotation to zero and adjust the positions of the mesh and colliders until they fit perfectly at hand.


PuppetMasterProp component:

PuppetMasterProp.png


Melee Props:

Lengthy melee props are a huge challenge to the PuppetMaster. Swinging them rapidly requires a lot of muscle force and solver iterations to fight the inertia and keep the ragdoll chain intact. The longer the chain of Joints linked together, the more inaccurate/unstable the simulation and unfortunatelly those melee props tend to be exactly at the ends of very long Joint chains (pelvis/spine/chest/upper arm/forearm/hand/sword). Besides that, as the props are swinged, they have a lot of linear and angular velocity, a very thin collider and therefore can easily skip the victim when its collider happens to be at the position between two fixed frames. It usually takes quite a lot of tweaking and some tricks to get the melee props working right. PropMuscles have the "Additional Pin" functionality which can be used to add another pinning point to the prop, helping to better pin it to high angular velocity animation.

PropMelee Component: (this component will be made more generic in PuppetMaster 0.4).

PuppetMasterPropMelee.png