Dose any one know how to send object current postion to preivues posistion

Hi all,

I m using car and car track when the car hits the sidewall collider that time it getting struck i want to send car back to its previous postion

please help me

thanks in advance

You just need to create a Vector3, and store the position, in which this case is a “checkpoint”. Something like this would work.

var checkpoint : Vector3 = ;
function Start ( ) { 
   checkpoint = transform.position ;

//Move the code from start to whenever you want to set this "checkpoint". From there on, you just need to set the position whenever gets hit .

function OnCollisionEnter ( collision : Collision ){
   if ( collision.collider.tag == "EnemyOrObjectName" )
      transform.position = checkpoint ;

Attach that script to your ‘car’. Good luck, and I hope this helped.

PS: Please let me know if this does not work for you, and I will approve it, and hopefully others can give some insight on the issue.

~Thanks for using Unity3D.