0 votes
asked in General Help by (150 points)

I have problem with implementing prop with new propmuscle (v0.9). I have combination of Puppet Master with VRIK. On Puppet Master component I'm add PropMuscle. Then I'm add PuppetMasterProp to my sword object. In play mode PropMuscle and AdditionalPin objects both have Rigidbody+Joint but not any collider component. On my sword I have box Collider. With this structure i can't detect any OnCollision events when I hit something with sword. Because on start PuppetMasterProp deletes Rigidbody Component from the sword. If i'm add Rigidbody to sword collider, sword become wobbling in hand.

So my question is this. On some purpose PropMuscle doesn't have any colliders?  Is this even ok to use propmuscle with VR or there is more officent way? 

(I'm using this tutorial to implement this https://www.youtube.com/watch?v=Bkw1gmrDr1I&feature=youtu.be)

Apologize in advance if the question is stupid and I'm miss something. 

1 Answer

0 votes
answered by (19.5k points)
selected by
 
Best answer

Hey,

What is happening when you pick up a prop is that the prop muscle is activated, the Rigidbody on the prop is destroyed, because the prop muscle already has a rigidbody. The prop along with it's colliders will be parented to the prop muscle so they will serve as compound colliders for it. That process is used for the sake of performance - it allows PM to add/remove props without restructuring the muscle hierarchy, that would be a slow and memory allocating procedure.

You can still get OnCollision events if you add a listener script to the prop muscle object (under PuppetMaster hierarchy), that passes these events to your prop script.

Or if you are using BehaviourPuppet, you can use BehaviourPuppet.OnCollision delegate:

void Start() {

behaviourPuppet.OnCollision += OnPuppetCollision;
}

void OnPuppetCollisions(MuscleCollision m) {

if (m.muscleIndex == puppetMaster.propMuscles[0].muscle.index) {

Debug.Log(m.colllision.impulse.magnitude);

}

}

commented by (150 points)
Hi, Thank you very much for answer. BehaviourPuppet.OnCollision event solved my problem.

Welcome to RootMotion Q&A, where you can ask questions and receive answers from the developer of Final IK and PuppetMaster and other members of the community.

Post as a guest, create an account or login via Facebook.

Please use the correct category when you post your questions.

...