- Home /
Pull/share an Object with multiple Rigidbody 3rd person Character controllers
I have been working on this for months. I keep working on it in 1 to 2 week spurts then deciding to come back to it later! I basically want to be able to "Team Carry" an object between 1-5 players (all local multiplayer on gamepads). This is probably the easiest example to help illustrate close to the behavior I'm looking for:
Mario Party "Dust Buddies" mini game
https://www.youtube.com/watch?reload=9&v=1LqvnR1IrLk
You can see 3 players controlling/pulling around a vacuum in the clip.
1.They each can pull independently of one another.
2.Their pulling can counteract/fight one another if walking in opposite directions.
3.The angle they are pulling at adjusts/rotates the object being pulled in a believable way.
Here is what I have currently working:
I am using a Rigidbody Character Controller solution. I am currently moving them using Vector3's derived from the left stick of their players gamepads.
The closest solution I have got to solving this is using spring joints. There are many different kinds of objects that can be grabbed/carried in the game. I basically have been manually adding "handle" areas(rigidbodies with some artwork to represent a handle) on each object as children, then I add a spring joint to the parent (one for each handle child) and connect their "connected body" segments to each handle Rigidbody. I then have a script that adds a spring joint to a PLAYER when they get in range and hold down the grab/carry button on their gamepad and that spring is destroyed when the player releases the button.
It works like this:
A-->B<--C
OR
GrabbableObjectSpring---Pulls toward-->>>Handle Rigidbody<<<--Also pulls toward--Player Spring
The handle kind of works like a buffer between the objects?
There are many problems with this solution:
It's unpredictable.
It stretches too far in many cases and the handles start overlapping one another and creating a mess!
Currently the spring joints manually placed on the object are not destroyed (to maintain connection to the handles) so they are always active and slightly jiggling. If the object happens to be off the ground when a player releases it it sloooooooowly lowers to the floor as if it's meeting resistance from the springs.
It SUCKS!
I have recently been trying to just move the object by adding the Players' rigidbody velocities to the object's rigidbody.velocity. That kind of works but:
1. It doesn't rotate the object
2. Players no longer have any spring pulling them back toward the object so if another player begins grabbing as well and pulls in the opposite direction, the players simply move out of range of the object while the object remains in place.
I am at my wit's end with this. I'm begging for a smarter and fresher set of eyes to take a look at this. Advice? Helpful code snippets? Is there a simpler way to approach this? Most solutions that pop up I've found are dealing with only 1 person (usually First Person VR grabbing) that don't really address the issues of my particular case.
@ThePwnicorn Could you share here a video recording of how your current mechanics play out, so we can better see what's wrong with them?
Yes. Hopefully this is clear enough.
I will update it in the Original post as well.
@ThePwnicorn Looks really cool already! I wonder if the Obi Rope asset supports your multi-pull use case? $$anonymous$$ight be worth asking its dev.
Your answer
Follow this Question
Related Questions
Rocket Jumping Woes 1 Answer
Hinge Joint Segments rotating offscreen 0 Answers
Hinge Joint rotating on its own 0 Answers
bouncing a puck of a vertical wall through code 0 Answers
Bend object with physics interaction 0 Answers