Download

Please help with uncooperative Mouse Trace?

Hi there, and thanks so much for checking out my question! :yellow_heart:

New here and to Unreal (and game development!) in general, so please be gentle.

I’m working on an isometric top-down 3D game (currently in 4.26.1). Because the orthographic camera doesn’t allow for post-process effects that are reliant on pixel depth, I’m actually using a perspective camera with an extremely low focal length yeeted super way back away from the stage at a 45 degree angle to achieve a psudo-isometric view, which is working great!

Except now when I go to get mouse events, which brings me to this forum.

No matter what I do, it seems that the hit results for On Begin Cursor Over always occur directly in the center of the camera view, and don’t track with the mouse cursor at all! Does this have anything to do with my… “unique” camera set up? What could I do to fix this? I can think of a few possible solutions (starting the trace from a plane scaled to the aspect ratio that moves with the camera view but way closer to the action and has 1-1 mouse parity was my first idea) but I’m unsure how to implement this or if there’s any more efficient ways around it, or even if my funky camera is actually causing it to begin with!

Any assistance at all will be extremely appreciated, and I’ll happily provide any of my current blueprints if they’ll be of assistance. Help a girl out maybe?

For actors that react to the mouse cursor like so:

image

You’re getting results that differ from this?

This is fov 1 with the cam some -50k uus awaaaay.

a perspective camera with an extremely low focal length yeeted super way back away

How extreme are we talking about?

if my funky camera is actually causing it to begin with

Any chance you could test it with less aggressive settings?

FOV is at 0.015°, camera is 10,000,000.0 cm away. And yeah, getting different results.

The Test text (and a debug marker I added to try to figure out where the hit results were) only shows up when I pan/zoom the camera, and the trace result always happens directly at the center of the camera, regardless of mouse position, as long as the mouse is actually on screen. Otherwise there dosn’t seem to be any mouse events firing. I took a video, but since I’m a new user the site won’t let me attach it, so I’m not sure what to do about that.

Working on testing with less extreme params, will report back. Thanks so much, I’ve been yanking my hair out.

Ok, reporting back.

With FOV at 1 and the camera much closer at 10,000 cm, the debug marker follows my mouse cursor properly, so it definitely has to do with my cam set-up. I also noticed that no matter what duration I set the Draw Debug String to, the “test” debug string vanishes immediately after the hit event, even with the closer camera, rather than lingering like your example? Weird. This seems to happen regardless of the object with Mouse Over Events enabled. No idea if that’s related, but wanted to mention it.

What you’re saying and observing adds up now - the extreme values are the culprit. This is the player controller that is responsible for the clicks you’re using:

image

The default trace distance is just 100k, orders of magnitude lower that your use scenario. The traces are not long enough and return null. You could crank it up… but!

You will experience other issues at that distance due to Floating Point Errors and the way the engine handles those large numbers. After 2500000 unreal units (cm), things will get noticeably more and more jittery and imprecise, and handling actors that are 10m uus away may not even be possible.

Try spawning actors from class at 11m uus and see what happens.


The tracing may just work well enough providing you’re trying to hit the broad side of a barn but one can forget about being pixel perfect :expressionless:

Yeah, I had cranked the trace distance way up, I didn’t know where it became unstable. Thanks for those values, I’ll give it a shot and see if I can make it work. Don’t need anything too precise for what I’m doing, I think.