Dragging and rotating a Rigidbody2D (Limbs with HingeJoint). Shadow Play / Puppetry Simulation

I’m trying to make a program in Unity for playing around with shadow play puppets (mostly “Karagöz”). The characters i want to use made out of jointed limbs. There is a hole on their upperbody which allows to use sticks to move them behind curtain and rotate the bodies: Example1

I build the 2D characters with HingeJoints to simulate how they actually move. i think best way to move them is using mouse. You can drag them with mouse and use the scroll wheel to rotate the bodies.


I put a circle collider on the hole of the character and used a similar script like this one to drag my character. My problem is the dragRigidbody2D solutions based on using a spring joint, and its just too springy for my usage and doesnt allow me to use rotating from the same point. I think its same for the TargetJoint2D. I made a little test and it looks way too springy too.

Has anyone an idea how to achive dragging and rotating 2D Rigidbodies with Hingejoints from this certain hole without making it springy / bouncey?

HI,

I have a lot of experience solving this problem with my performance animation / multitouch ‘ShadowEngine’ part-time PhD project. I collected 200+ images of Karagöz figures from European museums to use in the system.

The script you reference sets up a generic ‘dragging’ spring joint with default settings that pulls the hit rigidbody around.

Plenty of designs / approaches will achieve what you are after. My latest attempt experiments with how many touch controls are useable (in a HCI sense - mine is a multitouch context not just mouse control. Interestingly, mouse control is sometimes more effective / expressive thank multitouch when operated live). In the image below - each coloured drag zone is a ‘fixed’ hotspot and has different ‘spring’ settings attached to the local rigidbodies. Some controls are parented to another that when it rotates you get a ‘marionette’ controller effect which is very nice. Double click = rotate puppet to face the other direction (I tween the x scale). When using an iPad - this object rotates nicely around anchored finger points (in the XY plane). An effect I’ve been looking for for ages.

80005-screen-640x480-2016-10-12-22-31-53.png

One thing worth trying: a distance joint is a spring joint with the freq.= 0 and damp. ratio = 1 (I think). Play with those settings in the controlling spring object. I’ve thought it a good idea to expose the spring settings to edit them at runtime to get the right balance for each puppet. See the following thread - where I’m trying to create a generic UI for this: unity answers thread

You do have to iterate a lot with settings for the joints and rigidbody properties. e.g. Rigidbody: The mass of each object in the hierarchy matters as do the drag values.

It is easy to freak out the physics in these set ups. So finding ‘balance’ in the system is a careful act of tweaking settings…

I hope this helps. Do PM me as I’m interested in every digital puppety project I find.

Question: what ‘body’ do you rotate with the mouse?

Kind regards, Ian