#OnMouseEnter/RayCast timing

1 messages · Page 1 of 1 (latest)

brave shadow
#

Hi! When raycasting from my cursor onto an object that is moving together with the camera as its child, an issue appears where the hit is triggered without the cursor being placed on the target object as long as the cursor is near the object and the camera is moving so that the object is moving "ahead" of the cursor.

Imagine a box stuck to the camera and a cursor to the left of it. When the camera moves to the right it triggers the ray hit depending on how far away the cursor is from the object.

It's as if the movement happens a few frames before the raycast, and in that span of time the object manages to overlap the mouse cursor without it being visible to the player.

This happens both using simply an OnMouseEnter event on the target object or a direct raycast from the camera itself onto the object.

I'm unfortunately not able to provide any examples right now as I'm at work until the event is over but figured I'd ask in case there is a more general reason for this behaviour.

sour creek
#

this seems like a bug to me. id recommend filing a bug report when possible, id assume currently the ray is fired during a frame/tick where enough movement would mean the next frame/tick would be a hit and the visual line shown and the result are calculated on different frame/ticks so one is a hit one is a miss.

brave shadow
#

Thanks for the quick response 🙂 I'll put together a project demonstrating the issue and file a bug report when I have time.