Basically I want to have a connection between two (preferably not rigidbodies but if it needs a joint I can make a workaround) GameObjects. think of a rope, but it doesn't have to be rendered or have segments. When the two objects are connected if one object moves past the rope length it will either pull the connected object with it (if the other object isn't static) or pull the object back to the connected object.
asked May 26 '11 at 09:41 AM
All joints only works with rigidbodies since they have to add forces to both attached objects. You can set one of them to be kinematic, but the other one have to be non kinematic. Otherwise it will bypass physics simulation.
A Hinge Joint isn't a slider. it normally have a constant length (which can stretch a bit due to spring property). It sounds like you want just to limit an object to move further away.
If you don't use rigidbodies and joints, you can handle the case yourself. Is the one point at a fix position? If so the object that moves away just needs to check the distance and move it back until the distance is ok.
If both points can be moved it gets a bit tricky. If you want the same behaviour like the HingeJoint you just need to affect both points (the second point just in the opposite direction). That would enable one point to pull the second point towards he's moving.
If it should not pull the other object the above script should only be executed for the point that is moving. If both can move you have to switch the two points.
answered May 26 '11 at 10:02 AM