# Convenient way to determine exact point under mouse

**URL:** <https://forum.castle-engine.io/t/convenient-way-to-determine-exact-point-under-mouse/791>\
**Category:** 3D\
**Created:** [April 9, 2023, 6:03pm UTC](https://forum.castle-engine.io/t/convenient-way-to-determine-exact-point-under-mouse/791 "2023-04-09T18:03:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [April 12, 2023, 9:19pm UTC](https://forum.castle-engine.io/t/convenient-way-to-determine-exact-point-under-mouse/791/4 "2023-04-12T21:19:19Z")

</div>

It is possible. Albeit we would employ some assumptions/epsilons but yes, you can do this. It means you need to query for collision repeatedly – because the collision routines consider the geometry (ignoring whether the texture at them is transparent or not). So you need to make a collision query, then look if you hit a transparent pixel on a texture, and if yes – make a new collision query from a new origin.

To do this:

- You need to use a more general method `MyViewport.CameraRayCollision(RayOrigin, RayDirection)` . It returns `TRayCollision`, just like `MouseRayHit` (so it can be processed in the same way as above to detect the particular point). It takes as input ray position and direction.

- Use it in a loop.

---

_[View the full topic](https://forum.castle-engine.io/t/convenient-way-to-determine-exact-point-under-mouse/791)._
