---
title: "pointerToShapeLocal"
description: "The pointer in the shape's own coordinates: undo the layer's center, scale and rotation so a cursor force can act in the same space the swarm lives in (y up, isotropic)."
group: "simulation"
groupTitle: "Simulation"
categoryId: "sim.agentFrame"
categorySlug: "sim-agentframe"
categoryTitle: "Agent frame"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/sim/agentFrame.ts#L51"
---

# pointerToShapeLocal

The pointer in the shape's own coordinates: undo the layer's center, scale and rotation so a cursor force can act in the same space the swarm lives in (y up, isotropic).

```ts
pointerToShapeLocal(opts: {
    pointerX: number
    pointerY: number
    centerX: number
    centerYv: number
    scale: number
    rotC: number
    rotS: number
    aspect: number
}): {x: number; y: number}
```

Import `sim` from `shaders/std` and use `sim.agentFrame.pointerToShapeLocal`.

`pointerX`/`pointerY` and `centerX`/`centerYv` are in uv, `rotC`/`rotS` the cosine and sine of the rotation, `aspect` the canvas width over height.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `opts` | `{
    pointerX: number
    pointerY: number
    centerX: number
    centerYv: number
    scale: number
    rotC: number
    rotS: number
    aspect: number
}` |  |

## Example

```ts
const cursor = agentFrame.pointerToShapeLocal({pointerX, pointerY, centerX, centerYv, scale, rotC, rotS, aspect})
```

## See also

- [`force`](/docs/primitives/sim-agentforces/force) — The pushes an agent can feel.