Pull Script ?

How do i make my character Pull objects and have that play the Pull animation too? My character uses a character Controller… i tried the Push script… i still dont know how to make a pull script though

basically the pulled object has physics, is rigidbody, you only need to set the object mass less than your player controller (in case the player is rigidbody), then, when you collide with this box, automatically CrossFade the “pull” animation attached to your player…

yes… but then what is the script used to make the rigid body move in the backward direction as that of the player ?

could you just youse the smooth folow script? then just activate it when you hit the thing you wanto pull?or you could do something like this

var thingbeingpulled : Transform;

function OnTriggerEnter(thingbeingpulled: Collider)
{ 
thingbeingpulled.LookAt(transform);
if (Vector3.Distance(thingbeingpulled.position, transform.position)>2)
{ 
rigidbody.AddRelativeForce (Vector3.forward * 10);
}
}

its untested but i think this should work

I applied this to my character and put the cube as the Transform… But it is Not Working :frowning:

dose this work:

var target : Transform;

var distance = 10.0;

var height = 5.0;

var heightDamping = 2.0;

var rotationDamping = 3.0;



@script AddComponentMenu("Camera-Control/Smooth Follow")









function OnCollisionEnter(hit : Collision) 

{

if (hit.gameObject)

{



    wantedRotationAngle = target.eulerAngles.y;

    wantedHeight = target.position.y + height;



    currentRotationAngle = transform.eulerAngles.y;

    currentHeight = transform.position.y;



    currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);



    currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);



    currentRotation = Quaternion.Euler (0, currentRotationAngle, 0);



    transform.position = target.position;

    transform.position -= currentRotation * Vector3.forward * distance;



    transform.position.y = currentHeight;



    transform.LookAt (target);

}

}

untested aswell

unsuccessfull :frowning: :frowning: