Trying to make the rotation of something to the rotation of my spawned item

Im trying to shoot a bullet where when it hits an object, it gets the rotation and sets it straight against the object so that they are parallel. The code I am using is:

void OnCollisionEnter (Collision other)
{
	Quaternion rot= Quaternion.LookRotation (new Vector3 (1,1,1), other.contacts[0].point);
	Instantiate (cube, other.contacts[0].point, rot);
	cubeScript.cubeDown = true;
	cubeScript.cubeShot = false;
}

But whenever I try and do it it will rotate inside of the object and not be parallel. Can someone help me?

Thanks!

I don’t think that lookRotation is used in this sense.

static function LookRotation (forward : Vector3, upwards : Vector3 = Vector3.up) : Quaternion

You can see that the function needs a forward vector. This is the way that your object is facing. Not just (1,1,1). Try to get: other.transform.forward. And the up vector is not just the position of the the object. Try to get: other.transform.up.

Your code could look like this:

void OnCollisionEnter (Collision other)
{
    Transform otherT = other.transform;
    Quaternion rot= Quaternion.LookRotation (otherT.forward, otherT.up);
    Instantiate(cube, other.contacts[0].point, rot);
    cubeScript.cubeDown = true;
    cubeScript.cubeShot = false;
}

I don’t know if this is the correct rotation that you want, but you should search the reference guide first. If this is not the wanted rotation, please update your question with some kind of image that shows the correct rotation.