RigidbodyDrag along selected axis?

How could you use the rigidbody drag script but only along the x and z axis, not the y?

Post the script you are using, or a link to it.

just the DragRigidbody that comees in the standard assets

get the transform.position.y of the selected object in start function,then
while (Input.GetMouseButton (0))
{
var ray = mainCamera.ScreenPointToRay (Input.mousePosition);
springJoint.transform.position = ray.GetPoint(distance);
springJoint.transform.position.y = y;
yield;
}

Thank you hutao :slight_smile: i think that fixed it