---
title: "nearestSimulationEntity(for:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/physicssimulationcomponent/nearestsimulationentity(for:)"
---

# nearestSimulationEntity(for:)

Obtains the entity containing the physics simulation origin.

## Declaration

```swift
static func nearestSimulationEntity(for entity: Entity) -> Entity?
```

## Parameters

- `entity`: The entity to find the physics simulation origin for.

## Return Value

Return Value The entity containing the physics simulation origin or nil if the entity doesn’t have a parent object in the scene.

## Discussion

Discussion The simulation origin is the nearest parent object where a PhysicsSimulationComponent exists, or the root entity (normally the anchor) where the default simulation is embedded.
