However, when I’m not aiming at the floor but at anything else, it starts flickering. if I print a string for a tick along with the trace, displaying the name of the actor hit, the string will also flicker.
(in this video, start location was at the muzzle of the weapon, I changed it to camera manager to make it simpler and easier to debug, but the outcome is exactly the same)
Seems pretty wild, have you tried using the Impact Point as your end location instead of just Location? If that doesn’t work the only other thing I’d think of is a collision issue
It seems to be related to the mesh, and their collision meshes.
If I make a simple cube and export without changing anything, it works. If I delete the auto generated simplified collision and add a simple box collision, line trace will start flickering when hovering it.
now, If I get a cube that’s already not working, like the blue ones from the template, remove the simple collision, and add a 26DOP simplified collision to it, it stops flickering.
I have no idea how to fix it for skeletal meshes like characters, which is exactly what I need though since this line trace is for shooting enemies and causing damage without using projectiles.
Yeah, I have been testing with it unticked. if I tick it back, then it flickers with about every single mesh in the map.
It seems that the “get hit result under cursor by channel” node is bugged with some kinds of collisions.
If i use “convert mouse location to world space” it works just fine, even though I have no idea what’s the logic behind this math to convert a world location to turn into an actual world space location. either way, found this online, replicated, and it worked with all meshes:
(in this video, start location was at the muzzle of the weapon, I changed it to camera manager to make it simpler and easier to debug, but the outcome is exactly the same)
it happens with all meshes. i thought it wasn’t happening with the ground mesh, but that’s because collisions for it are off, and the line trace is actually interacting with the under side of the ground which is a separate mesh, and it is tracing the back face of it. probably has default collisions
Thanks! This worked perfectly, it’s exactly what I wanted.
I guess my initial issue was that I was ending the line trace at the cursor world location, and not multiplying it by anything so it would extend beyond that point, so every other frame it would just randomly end just short of hitting the object under the cursor.
The limiting to a horizontal plane should also work for what I’m thinking, but is there a way to limit it to an angle, instead of a plane? like a vertical 2d cone instead of a plane
And the only other thing I can think of asking is how would you add a bit of random variation to the hit point? I figure I’d add some random floats in range for the X and Y values of the end location, but I don’t really see where, and this didn’t work: