Physics (should be a separate forum for this :) )

Hi all,

I have a very basic cube hinge joint to my player i.e. the cube follows the player ; which is great. (player is a character collider and rigid body).
If the cube gets stuck on a corner though the player can continue moving and ‘stretch’ the joint until the force is so great the cube goes straight through the scenery to be back with it’s beloved anchor body :slight_smile:
How can I have the cube jointed to the character controller control the character controller i.e. if the cube can’t move in a direction it stops the character controller from moving and hence stretching the joint.

Any help appreciated

Hey,

Probably this will not help much, but do you really need it to be a joint? can’t you make the cube be a sub-object from the player?

The problem is that the CharacterController doesn’t work with forces but with velocities, I think. Therefore you have to write your own CharacterController script. Another possibility is to disable player movement in one direction if the cube collides and gets stuck somewhere.

I would just check compare the velocities of the objects. If the CharacterController velocity is greater than zero and the rigidbody velocity on the hinge joint object is zero, then it got stuck somewhere, so flip a boolean or something on the controller so he can’t move away from the hinge joint object.

Hi all,

Well :slight_smile:
I’m not sure of which approach is best.
I assumed using rigidbodiies would be best; although when the cube is under player control I almost :slight_smile: don’t want physics.
I assumed also that a hinge joint would be best; but perhaps it isn’t necessary?
Will try some of the suggestions and report back.

Cheers

I would rather compare distance between player and cube and if the distance starts to grew over some limit I will simply reposition the cube at the correct distance to the player.