# Wrong collision sensing "event.contact.isTouching"

**URL:** <https://forums.solar2d.com/t/wrong-collision-sensing-event-contact-istouching/151312>\
**Category:** Physics\
**Created:** [March 2, 2020, 11:59am UTC](https://forums.solar2d.com/t/wrong-collision-sensing-event-contact-istouching/151312 "2020-03-02T11:59:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zombiexp2010](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/z/7993a0/32.png) [@zombiexp2010](https://forums.solar2d.com/u/zombiexp2010)\
**Post date:** [March 2, 2020, 11:59am UTC](https://forums.solar2d.com/t/wrong-collision-sensing-event-contact-istouching/151312/1 "2020-03-02T11:59:47Z")

</div>

```
Collision listeners: local function sensorL\_Collide(event) if event.contact.isTouching then sensorL.collide = true if event.other.type then sensorL.groundType = event.other.type end else sensorL.collide = false sensorL.groundType = "None" end end local function sensorR\_Collide(event) if event.contact.isTouching then sensorR.collide = true if event.other.type then sensorR.groundType = event.other.type end else sensorR.collide = false sensorR.groundType = "None" end end ----------------------------------------------------------------------------------------- Enter frame: if not sensorL.collide and not sensorR.collide then isGrounded = false else isGrounded = true end print(tostring(sensorL.collide).." "..tostring(sensorR.collide).." "..tostring(isGrounded)) ------------------------------------------------------------------------------------------ sensorL:addEventListener("collision", sensorL\_Collide) sensorR:addEventListener("collision", sensorR\_Collide)

```

“sensorX.collide” and “sensorX.groundType” - additional non-system variables

I know about “tutorial/games/nonPhysicalCollision/index.html” but I think this a very bad approach to invent such crutches while there is already a system that should work.

Time between sensor falls from “ground” to “platform” is few frames while iterations go three times every frame by default.&nbsp;

Any ideas? Something missed? Something missunderstanding? Please?

ALSO \<pre\> and \<post\> collision event is NOT WORKING if object.isSensor = TRUE but works great if an object IS NOT SENSOR!!!&nbsp;

---

<div class="post-metadata">

**Author:** ![zombiexp2010](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/z/7993a0/32.png) [@zombiexp2010](https://forums.solar2d.com/u/zombiexp2010)\
**Post date:** [March 2, 2020, 1:28pm UTC](https://forums.solar2d.com/t/wrong-collision-sensing-event-contact-istouching/151312/2 "2020-03-02T13:28:38Z")

</div>

Now the problem is partially solved:

1. Sensors deleted because post-collision event is not working for sensors

2. Post-collision event is firing for main body and \<isTouching\> works great

3. Comparing \<event.y\> coordinate with main body bottom. If true -\> collision happens with ground

very bad because I can have a circular located rotating sensors for some advanced cases…

---

<div class="post-metadata">

**Author:** ![XeduR](https://forums.solar2d.com/user_avatar/forums.solar2d.com/xedur/32/256_2.png) [@XeduR](https://forums.solar2d.com/u/XeduR)\
**Post date:** [March 2, 2020, 6:10pm UTC](https://forums.solar2d.com/t/wrong-collision-sensing-event-contact-istouching/151312/3 "2020-03-02T18:10:21Z")

</div>

Good to hear you’ve solved your problem at least partially.

Now, sorry, but what are the remaining issues that you are facing?
