- Home /
Missile Trajectory Change Course.
I took a photo of the code as it would be easier to read with all the comments.
What I am trying to do, is pretty much the raycast, with a Vector3 Raycast I couldn't figure out how to use a RaycastHIT for a Vector3 (gives an error).
So pretty much what I am trying to do is with that raycast inside #region Missile AI to override the #region Trajectory to change the missiles course if there's an object within 30 meters of it.
The comments explain a lot with what I am trying to do.
Answer by Frozaken · Nov 07, 2016 at 08:35 PM
Your raycast should look something like this
RaycastHit hit;
if(Physics.Raycast(transform.position, scanTrajectory,out hit,30)){
//stuff
}
you can then find alot of information in the hit variable, such as the barycentric coordinate, normal, distance and alot of other useful stuff you could maybe check for the distance from the target, and then make an evasion move accordingly.
Thanks, checking that out now.
Compiled..
$$anonymous$$arking as correct. as I can use my out hit now. Thanks man.