# \[Box2D\] Reference sensors inside a body

**URL:** https://forum.kirupa.com/t/box2d-reference-sensors-inside-a-body/328402
**Category:** flash
**Created:** [May 15, 2012, 12:23am UTC](https://forum.kirupa.com/t/box2d-reference-sensors-inside-a-body/328402 "2012-05-15T00:23:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![noisavni](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@noisavni](https://forum.kirupa.com/u/noisavni)
#### Post date: [May 15, 2012, 12:23am UTC](https://forum.kirupa.com/t/box2d-reference-sensors-inside-a-body/328402/1 "2012-05-15T00:23:10Z")

</div>

I’ve made a slug character

which is a rectangle with a sensor on each side. I’m trying to get it to switch directions once it bumps into a wall or something. But how do I reference a sensor inside a body?

normally I would call the userdata from the body which holds a skin class. But the userdata is for the entire body and not for individual shapes. What’s the best way to solve this?

p.s. I’m using the old version of box2d. (if it matters).

Cheers
