All Classes Namespaces Functions Variables Enumerations Properties Pages
Props

PuppetMaster includes a helpful tool for attaching, detatching and managing physical props - the PropRoot and Prop classes. The former can be thought of as the attachment point on the character, the latter defines some main requirements for the object to be used with that attachment point. For an example of prop usage, please see the "Prop" and "Melee" demo scenes.

Prop Setup:

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

Prop.png
PropScene.png


PropRoot Component:

As mentioned above, the PropRoot component is the attachment point of a prop (of any kind) and should be parented to the Target hierarchy. For example in the case of a sword held in the right hand, the PropRoot.cs component should be on a GameObject parented to the right hand bone of the (Target) character, positioned at the palm and aligned to the rotation of the hand.

PropRoot.png

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

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

When a prop is attached to the PropRoot, it's localPosition and localRotation are set to zero/identity, so when you wish to adjust the prop's holding position or rotation, just adjust the PropRoot.

PropRootHierarchy.png


Prop Component:

Props used with the PropRoot component need to extend the abstract Prop.cs class. For an example, please see the PropTemplate.cs script.

PropTemplate.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 it's 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. The Prop component has the "Additional Pin" functionality which can be used to add another Muscle to the prop, helping to pin it to the animation.

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

PropMelee.png