I have two objects in my scene. Both their positions change constantly, and I want to cast a ray from one to the other. I'm not exactly certain how to derive the direction vector though. I am using the raycast action, which originates on ObjectA, and from ObjectPosA (for the position variable). I want to cast directly at ObjectB the entire time, with the goal being to collect information on whatever objects come between the two.
To make it a bit simpler, the two objects are always on a 2D plane, so I really only need to worry about the Y angle.
Can someone shed some light on what actions I need to use to derive the direction between the two objects and feed that into the Dir variable in my Raycast action?
Things I've tried -
Having ObjectA LookAt ObjectB, but there was no direction variable I could retrieve from this action.
I tried giving the euler Y value from ObjectA while it was using the LookAt action, and adding it to a vector variable to use as my direction, but this did not work.
I tried using GetTransformDirection, but this Action was a bit confusing to me as it seems to want a Direction vector to transform to worldspace, so it did not seem to be what I was looking for either.
Finally, of course, I just used a GetRotation action to derive the vector of ObjectA and feed it directly into the Direction variable for the Raycast, to the same result.
The majority of these attempts usually resulted in my Raycast pointing directly up, rather than at ObjectB. I'm sure this is an elementary mistake on my part but I'd appreciate any input.
Thank you in advance!