# transform

> The Transform of the object we hit (Read Only).

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.PhysicsModule

```csharp
public Transform transform { get; }
```

### Remarks

If we collided against a collider with a [Rigidbody](/engine/6000.7/script-reference/unityengine/rigidbody.md), the transform will be the transform attached to the rigidbody. If we collided against a collider without a rigidbody, the transform will be the transform attached to the collider.

### Examples

```csharp
 // Attach this script to a GameObject with a Collider and Rigidbody.
 // Make sure the object you’re colliding with also has a Collider (and optionally a Rigidbody).

using UnityEngine;

public class CollisionLogger : MonoBehaviour
{
    private void OnCollisionEnter(Collision collision)
    {
        // Get the transform of the object we collided with
        Transform hitTransform = collision.transform;

        // Log the position, rotation, and scale of the hit object
        Debug.Log("Collided with: " + hitTransform.name);
        Debug.Log("Position: " + hitTransform.position);
        Debug.Log("Rotation: " + hitTransform.rotation);
        Debug.Log("Scale: " + hitTransform.localScale);
    }
}
```
