Hello. I’m trying to create a melee system and I’m having a little bit of a tough time… I can get it mostly working, but there are flaws with whatever method I come up with.
The desired type of functionality I want is basically that of Robo Recall when picking up robot pieces. They interact with the world, they get pushed back by world objects, but otherwise they’re constrained to the hand.
I started with a Physics Handle. This works when standing still, I get resistance on my melee weapons, they’re blocked by the world, I can apply different levels of force for different effects on my NPCs.
But the major issue is when walking around or waving the weapon around. It’s not very constrained to the hand. When moving (I use character movement), the object will lag behind you.
You can kind of increase the stiffness and dampness to improve this, and maybe that’s the solution, but my results weren’t super satisfying. It seemed issues popped up as I changed those values. And in the end it never really fixed the issue with constraining when moving.
My next solution was to use a physics constraint component on the melee weapon and constrain to the hand. This works perfect for when moving around, and is okay for melee attacking, but it brings up resistance issues. IE when you push the object into the wall, it’ll try to reach inside the object and then start going crazy teleporting all over the place.
You can fix this by turning on the soft constraints on the physics constraint, but even tweaking these values I could not get an effect where they were always 1:1 with hand position UNLESS there is outside resistence (NOT including player velocity), which is my desired effect.
Basically I only want the soft constraints to kick in when force is being applied, so a wall will block an object, and you can hit in melee and apply force.
How would you go about this? It feels like I’m trying to shove a square peg into a round hole atm. But I’m really close. Robo Recall has it perfectly (although not with movement, but the melee items properly are constrained and respond with appropriate force)