Hi,
Any way to shoot a line trace in the centre of the screen and then also do others evenly spread in a radius? I can do a centre line trace but not sure how I would spread them out evenly
Hi,
Any way to shoot a line trace in the centre of the screen and then also do others evenly spread in a radius? I can do a centre line trace but not sure how I would spread them out evenly
In a nutshell: Trig functions.
Longer version:
n
) on the radius you want, call this ThetaStep
, set another local Theta
to 0 to start offn
times, adjusting the centre point each time using trig functions on Theta
and your up and right vectors, and adding ThetaStep
to Theta
after each.That, in a function:
Example usage:
I just saw their post on reddit and was working on this problem for them because I was curious too lol glad I came across your solution. Would’ve taken me a while to figure that out.
That’s brilliant thanks . I am however having difficulties trying to add it to my weapon system if you can offer some more assistance.
I just need to add a cross reference point from the camera and the weapon itself, problem being the first 2 traces line up but the spread in pink doesn’t, it should be inline with the red one.
I’m also using a custom channel for the shotgun so that I can penetrate certain objects and enemies. Here’s what I changed for ref
You will just need to recalc the forward vector, using the end point and the weapon location.
Please forgive the formatting, wanted to make it obvious what needs to be added
Edit: Ooops… also reset Forward Vector
to the normalised value, before scaling it and setting Forward
.
Edit2: Double Oops, you don’t have that, but create a local and use that instead of the Get Player Camera Manager
→ Get Actor Forward Vector
in the middle sequence path.
Thanks for the help, got it nearly working with some minor tweaks
still need this in the middle section as the player camera though otherwise it never draws
This part does need the Forward vector though
Only problem now is when using the custom line trace, I can’t damage anything. By default the collision response is set to overlap so that I can go through multiple objects, any ideas?
still need this in the middle section as the player camera though otherwise it never draws
Ahh, I believe I have created some confusion by choosing some rather bad variable names. You need a normalised forward vector for the cross products in the middle sequence path, and you should use the recalculated one or your traces wont be square on (will be hard to notice if the difference between the camera forward and recalculated normal is small, so maybe ignorable, but it is ‘wrong’ as stands).
Rename Forward
(which you may have renamed Local Forward
?) to Forward Scaled
, and add another local variable called Forward Normalised
, the recalculation should then look like this:
Use Forward Normalised
in the middle sequence, instead of the camera’s forward vec, and use Forward Scaled
to calculate the trace end points (already doing this).
the collision response is set to overlap so that I can go through multiple objects
I have no idea off the top of my head for this sorry, if not blocking then there will be no hit, and this being a trace there will be no overlap events.
I think all damagable actors will need to block these traces, but I am not experienced enough with this stuff to say for sure.
Really hacky and horrible workaround idea: make damagable actors block the traces, when you hit something, damage it then redo the trace with that actor added to Actors to Ignore
array.
@DarkEmbrace96
Happy coincidence, was just searching for something for my own purposes when I came across this:
Managed to sort the collisions thanks to your post below :).
Still not sure on the normalize/scale vectors, they don’t seem to work for me, maybe something to do with my weapon? None the less it works with this setup, can even add a slight offset like below
Final result looks like this
I moved a bit so you can see the trace, but they all line up where they should
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.