PuppetMaster UCC Puppet Not Responding To Being Attacked

Nicky_g_

Member
How's it going?

For the past couple of weeks I have been trying to get my PM puppet to react to getting shot similar to this video I found online: Working Integration (example found online)

Currently, I've been able to get PM to work in my project and the puppet reacts to collisions but will not respond to getting shot even when I set the impact layer to collisions or any other layer for that matter.

Link to my issue

I'm at my ropes end and not sure what else to try. I followed the comments in the video liked to above but it still won't work.

Is there a video or write up on how to get this to work?

Thank you!

(A copypasta from my post over at RootMotion, their forum isn't as lively as this one)
 
The PuppetMaster integration does require a lot of steps in order to get working correctly. Partel recently updated the integration with an editor that will help you get going as well as a video that you can follow. I've updated the PuppetMaster documentation to point to that:

 
Thank you Justin!

I've been able to get a reaction that I think will work well in my game.

I may do a tutorial video or write up if need be. For now here is the code needed to create a script that should be attached to weapon that will be used to attack an object that has PM setup on it. After the script is added (for example the assault rifle) and the layer set to Ragdoll it should be dragged into the OnHitscanImpactEvent event field and it should work.

///----------------------------------------------------------------------------------------------- /// This script is a slightly modified version of the RaycasterShooter.cs script created by RootMotion /// to be able to work with UCC's ShootableWeapon.cs OnHitscanImpactEvent /// Contact me at Nicolas@fairwayevil.com if you have questions ///----------------------------------------------------------------------------------------------- using RootMotion.Dynamics; using UnityEngine; public class PMPusher : MonoBehaviour { public LayerMask layers; //Choose the layer that the PM Ragdoll components are on public float unpin = 1000f; public float force = 1000f; public void SecondRay(float dmg, Vector3 positionOfImpact, Vector3 fireDirection, GameObject attacker) { Ray ray = new Ray(positionOfImpact, transform.forward); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, 100f, layers)) { var broadcaster = hit.collider.attachedRigidbody.GetComponent<MuscleCollisionBroadcaster>(); if (broadcaster != null) { broadcaster.Hit(unpin, ray.direction * force, hit.point); } } } }

I hope this helps someone else in the future!
 
Hi, I was able to set this up on a projectile arrow, I am trying to use the PM ragdoll colliders as hitboxes for UCC Character Health, but the character is not losing health attribute when shot. It takes damage when PM is a child of UCC Health but doing so breaks unpinning. How did you set up the hitbox colliders ?
 
Hey @snicker , UCC (AFAIK) only recognizes hit boxes that are children to whichever game component has the UCC controller on it.
For my project I added colliders to the model rig and then added them to the Hitboxes under the Character Health component.
1614728714224.png

Works like charm for me.
 
This works for hitscan shootables, but when I set up with a projectile it either collides with the hitbox and does damage but doesn't stick, or collides with the ragdoll and sticks but doesn't do damage, depending on which Impact Layers are set in shootable.

It looks really cool when the arrow is stuck in the puppet and weighs down that limb, I would like to find a way for projectiles to cause damage and stick to the ragdoll.

It works with melee weapon too its really just the sticky projectiles I'm having trouble setting up with the PM integration
 
Last edited:
I am currently doing something similar but with a golf ball. What I've done is I let the ball do the damage and on impact I cast out a ray to affect the rag doll. In your case I would cast a ray out in the direction of the arrow head.

My idea is to let the physical object do the damage and let the Puppet Master Pusher ray handle the ragdoll unpinning.

1614822264164.png

It's not working 100% but I think this is the way to do it. Let the arrow be collide with the enemy so that things look right and then have the Puppet Master Pusher ray cast once it makes impact so that the unpinning effect can be shown.

Here is my not perfect implementation, I need to mess with my layers a bit:



I hope this helps and if you think or find a better way, please let me know!
 
Using collision layer for weapon/projectile hitboxes, UCC Health colliders are subcharacter layer, PM colliders are ragdoll layer.
Also disabled collision matrix between subcharacter and ragdoll in project settings.

Impact layers for weapons are subcharacter, default, moving platform.
I used PM's editor to make colliders on PM ragdoll, then copied those collider values to the UCC root rig so the colliders are different layers but in the same dimensions. Having a double set of colliders does not feel like it'd be performant, but I cant get this working on one set.

Set projectile to Sticky object on PMPusher.

My arrows stick in the ragdoll and deal damage, but about 10% of time the arrow will not reparent and float midair after dealing damage, its good enough for now.

Also, I'm using the OnDeath event on Character health to run Kill() on PM component, when killed, ragdoll ALWAYS falls forward on his face, but when unpinned from damage he falls as the force pushes him. I played with the state parameters for kill on the puppetmaster inspector to no avail.

Here's my changes to PMPusher

Code:
using RootMotion.Dynamics;
using UnityEngine;
public class PMPusher : MonoBehaviour
{
    public LayerMask layers; //Choose the layer that the PM Ragdoll components are on
    public float unpin = 1000f;
    public float force = 1000f;
    public GameObject stickyObject; // sticky projectile, can be null
    private Transform newParent; // the transform hit by Secondray

    public void SecondRay(float amount, Vector3 positionOfImpact, Vector3 fireDirection, GameObject attacker)
    {
        Ray ray = new Ray(positionOfImpact, transform.forward);


        RaycastHit hit = new RaycastHit();
        if (Physics.Raycast(ray, out hit, 100f, layers))
        {
            var broadcaster = hit.collider.attachedRigidbody.GetComponent<MuscleCollisionBroadcaster>();

            if (broadcaster != null)
            {
                broadcaster.Hit(unpin, ray.direction * force, hit.point);
             
            }
            if (stickyObject != null)
            {
                newParent = hit.collider.attachedRigidbody.transform;
                stickyObject.transform.SetParent(newParent);
            }
        }
    }


}
 
Last edited:
Top