portals + AddForce = #$%^

Trying to recreate “Portals” mechanics… Everything works fine, but… when i’m throwing the rigidbody into the INportal with AddForce, after apearing in OUTportal, rigidbody is still moving in the same direction as it was thrown.

void OnTriggerEnter (Collider collision){
		ObjectToTeleport = collision.gameObject;
		if(this.name == "portalIn"){
			PortalOut = (GameObject) GameObject.Find ("portalOut");
				if(PortalOut==null){
				return;
				}
			ObjectToTeleport.transform.rotation= PortalOut.transform.rotation;
			ObjectToTeleport.transform.position = PortalOut.transform.position;
			ObjectToTeleport.transform.Translate(Vector3.forward * 2);
		}
		if(this.name == "portalOut"){
			PortalIn = (GameObject) GameObject.Find ("portalIn");
			if(PortalIn==null){
			return;
			}
			ObjectToTeleport.transform.rotation= PortalIn.transform.rotation;
			ObjectToTeleport.transform.position = PortalIn.transform.position;
			ObjectToTeleport.transform.Translate(Vector3.forward * 2);
		}
	}

As U see i’m changing object’s rotation to match OUTportal’s rotation, but it does not help…

Just zero out the velocity when it enters the first portal with rigidbody.velocity and modify it from there…

Thanx, it’s not the fanciest way but it did a trick.

Can you not multiply the velocity by the portal’s rotation, since Vector3 * Quaternion = Vector3?