How does one constrain an actual character?

I’ve been trying to use physics constraints to prevent the character from sliding downwards when using the cable component. I’ve tried to use the physics constraint components but it doesnt seem to want to attach to the players’ capsule component or mesh. I’ve also tried using a physics constraint actor on the capsule component but when I simulate physics on it, the player can no longer control the movement. They’re just frozen still. Any help?

The capsule is not bound to a simulated mesh normally.
when ragdolling you usually force it in place by moving the caspluse with the pelvis.
This is because normally the root bone is kinematic.
at least, thats how most live trainings set it up.

You should probably define this sliding downwards. And better define what it is that you want to do.

Say you want to attach a a piece of the character to hang him by an arm for instance.
thats a bit of a different procedure.
with simulate physics on, I would attach the bone to something.

The purpose of what I’m trying to do is to have the player character grapple to an actor and have the ability to swing from it freely. I know how to do the physics of the actual swing but at the moment the character slowly sinks downwards when grappled, as if the cable were stretching.

I’m trying to solve this by placing a constraint to limit the characters’ movement in a radius defined by the cable length. The part I can’t get working is the physics constraint. Evidently I’m doing something wrong.

Would you know how to properly set this up so that the player character is constrained in this manner? Animations and making the character look like they’re swinging aside.

I would tether the actual movement capsule with simulate physics on that, not the mesh.

First you would have to disable the movement mode.
like for slopes or climbing.
then you can attach the capsule and probably constrain the tilt of the forward vector.

Otherwise, you can try to attach the actor and simulate physics on him.
but you would make the root bone kinematic which should keep the movement component attached.

also, check that the falling you are getting isn’t due to something else like the cable component, or the character.
show bones will help figure that out.

Sorry I’ve been so long. I was having trouble signing into my Epic account.

I think the best course of action would be to constrain the actual character mesh. I’ve already tested constraining the capsule and it seems it may work with a lot of heavy tweaking and functions. But I wondered if your other suggestion would lead to more realistic results, so now I’m taking a look into it. But I’m having problems with getting the mesh to actually conform to the constraint.

At first, I used a physics constraint component, but no matter what I did the constraint didn’t actually connect. I watched it in the viewport and wanted to see if it was a problem with the constraint itself, so I set it to constrain the rope as the second component and the line connected. Set it back to mesh (inherited) and nothing happened.

So I moved to spawn a physics constraint actor when grappled and setting the constraints from within a blueprint, but it still won’t properly constrain.

This is my function for the constraint. which is inside the ThirdPersonBlueprint that I use for my character atm:

https://i.gyazo.com/a398134831657f71640d7f69e2c670f0.png

https://i.gyazo.com/1f7a943a70790e854dd628c68e6c5058.png

The branch from the first picture comes from an event tick node just so you know. And I’ve set simulate physics on my characters’ mesh.

Baseline - no physics constraint I use will connect w/ my characters’ mesh or his capsule component.

Know any reason why this may be happening? maybe I’m just a dummy and missing something basic.

Possibly. The spawned actor is not spawned as part of the actor but as a new actor.
If that is the case, then when you try to link the mesh as a component the actor has no idea what the mesh you are passingactually is.

Terefore, if any of that is true (and even if it is not, this is worth a try), create or add a physics constraint as a component within the character blueprint and change the code to enable/disable it at runtime (replace the spawn node).

Aside from this.

moving to, and enabling a rope grab shpuld probably attach the rope to the hand socket like you do a weapon.

The difference will be that the rope won’t move around with the character like a gun would, because the tip of the rope or cable component is affixed to static world location.

This is one movement mode I really don’t have a need for, or I’d make a short tutorial on it and fully explore it…

ideally, you would want the user input to apply momentum in the forward and backards directions so that you can increase and decrease the swing natually with just the physics simulation.
You apply that on the capsule component.
if the capsule component is not attached to the character, then you won’t get the result you expect.

thats why attaching the capsule itself may be a better alternarive.

Btw, it appears im telling you to do exactly what the docs say…

That literally doesn’t work for me. No matter what I do, a physics constraint component won’t connect to either the characters’ capsule or mesh. The lines arent drawn in the viewport, the effects of it aren’t felt whiles playing or simulating. I set up a node tree to try and see if it was just some random bug and it actually was connected but, nope.

That’s my base problem here. Sorry if I confused that.

The function I shared before was just my attempt to circumvent this problem by using an actor instead of a component. But since it can’t recognize what mesh I’m passing actually is, guess that won’t work.

Bumpity bump bump

If the constrain does not work (and you are sure that before enabling it you have the movement mode disabled), then go back to the socketing way.
Attach the mesh to the component, and with the root bone being set to kinematic, hopefully, the collision capsule will just stick along for the ride.

You should be able to copy the base behavior from any climbing tutorial btw. They use a root montage to climb up, since you don’t need to climb you can skip that part, but the whole part where the mesh is attached to the climbing spot should still apply.

I got it working!! I had to make another static mesh blueprint, create the constraint within the blueprint components, then attach it to the character from within the characters’ event graph. I used the basic movement mechanics supplied w/ the third person character to transfer the force from the character movement controller unto the static mesh.

Though I have to keep the limit on locked due to physics weirdness when it is on limited. Though I have plenty of ideas on how to fix that. Thank you very much! :):slight_smile:

Hi, I’m reviving this thread with the hope that you might still respond and still have access to the code you were working on. Can you please elaborate this answer? This is the only meaningful thread I’ve found on this subject and your “figured it out” post is very vague. Could you expand on and maybe share pictures?

Thanks!

P.S. reminded me of this
wisdom_of_the_ancients

1 Like

Bump. How did you get this to work?