How to make a raycast start position change
Hello! I was wondering about how do you make a raycast's start location change by a value. I have my raycast currently setup with the start position being the actors start position. Would I have to add on values to make the start location move? I am trying to make the raycast move a predefined amount to the left or right depending on which bullet the player is on (I have an ammo system already in place, and the branch is working, I am just wondering how to make it move to a predefined location each time the player fires). Cheers!
Just add some value to the player position before feeding it to your start position.
If you want to move it relative to the player position you have to get "Forward Vector", "Up Vector" or "Right Vector" and multiply it by however far you want it to be deplaced.
Those three vectors are all exactly one unit long which means multiplying the vector with 100 gives you a vector with the length of 100.
answered Jan 08 '16 at 03:59 AM
coordinates are your xy(z), if you change any of them you change your position, z being the altitude. So it all depends on where you want the vector position to end up. I would get a fresh vector of the end location and interpolate to that, unless you're doing something like a non-linear trajectory trace, in which case you would want to offset your starting position by a small amount each step, is that what you are trying to do? here is a small example I use for tracing my jump trajectory, unfortunately you have to take all your variable changes into account, so if you mess with speed (of the bullet?) later on, or with friction, it won't be precise.
Follow this question
Once you sign in you will be able to subscribe for any updates here