Download

How To Simulate Mouse Over on a 3D Actor in a Level

I am wanting to be able to have Actors in a level respond to the mouse cursor being over them; in a similar fashion as mousing over a unit in a game in the RTS genre.

My thoughts have been to do line casts (ray casts) from the mouse cursor into the game scene; but my concern is if this will cause a hit to performance, as this would require line casts to be sent out at most once per frame, but at least once every few frames. That’s a lot of line casts.

Does anyone have any experience in setting up mouse over type events inside a level, with 3D Actors? Thanks.

If you check out the description you will find "While the butterfly is in flight, it continuously draws a line trace ahead of itself to check for obstacles. " which seems to indicate this will not be an issue in UE4. I know in Unity a raycast is very negligible in terms of a performance hit especially if you are only doing 1 a frame so it seems like it is the same for UE4.

Hope this helps.

Thanks for the help

It sounds like my original thought process for how to solve this problem were right. Thanks for the docs reference. It’s super helpful.

Add a static mesh to a blueprint and right click. Go to the add event option and you get a collection of events that will get added to your event graph for the given component.

&stc=1&d=1405986176

I hadn’t seen that Event type. Very nice. Thank you! I’m assuming it can be attached to other Components as well, such as a Sphere component; so that the Mouse Over radius for an object could be adjusted?