The next piece I want to implement is being able to drag stuff around with your noodley tentacles. My first thought was to use physics constraints to setup a connection between any physics-enabled actor in the scene and the skeletal mesh that I use for the octopus. I’ve been able to get it attached fine, but the performance doesn’t really give me what I want. Despite whatever settings I set the constraint to have, I’m able to pull the pieces apart and twist the attached tentacle into a state where the physics doesn’t seem to be able to resolve. It will just twitch in place endlessly. Another problem is that if I apply torque in such a way that the tentacle that’s attached gets pulled under the body, then the whole mesh has a chance of being shot off into space. But the biggest problem is definitely being able to pull the tentacle off the surface really easily.
What I’m looking for is to have the tentacle touch an object, have it attach to the object, and then by applying torque to the ball shape of the skeletal mesh I can then exert forces on the other actor. By sticking the tentacle to the surface, it should become fixed on the actor, so if I apply torque in the other direction but it’s too heavy, it should prove impossible to move away with it.
I’ve also tried a physics handle, but this seems to disable all weight on the attached actor, so it just flies through space with the tentacle’s tip. Also the same problem occurs where rolling tentacles under the body will cause some serious problems with shooting the whole character off in one direction.
I can try to provide more screenshots or video if anyone would find that more helpful. Anyone have any ideas for a better way to approach this problem? Thanks!
I got to the bottom of the problems I was having with attachment using constraints.
I was attaching things in the wrong order. Attaching the correct bone to the correct component according to the Hit event is critical. In my case, I was setting the constraint component to have the hit component as component 1, the hit bone as bone 1, and my component as component 2. This was backwards, you’ll want component 1 to by my component, and component 2 to be hit component.
The next thing I ran into was not placing the constraint in the correct place. When you use Add Physics Constraint Component, it will generate the constraint at 0,0,0. I called Set World Transform for the constraint and passed it the hit location and normal and it is giving me much better results.
It seems like the final piece of the puzzle is a weird offset I’m getting after setting the constraint. I’m not sure how this distance is getting set, but it’s locking the constraint to it:
The red line there shows the distance between the bone constrained by this constraint component and the impact point. This point doesn’t seem related to the location of the constraint, oddly. Anyone have any idea what this distance could be and how I can move it around?