This member has provided no bio about themself...

Comment History
Boostback
Boostback - - 5 comments @ (GameDev) Introduction to Proportional Navigation (Part I)

I see, anything close to proportional works though I guess. It isn't an exact science for what I need it for (and I don't think it is an exact science in general, that would be optimal control). About the cross product, If I understand it correctly that could also work and may give you an exact proportional relationship. I haven't done the math for this, everything is based on intuition.

Good karma+1 vote
Boostback
Boostback - - 5 comments @ (GameDev) Introduction to Proportional Navigation (Part I)

The length of the difference of the Line of sight vectors encodes this information. In others words, the length of the vector obtained by substraction is directly proportional with the change in line of sight angle. By encoding it in a vector you get all the information you would get from the change in line of sight angle *plus* the directional information for free.

Good karma+1 vote
Boostback
Boostback - - 5 comments @ (GameDev) Introduction to Proportional Navigation (Part I)

You subtract these vectors to get the change in line of sight. If you subtract two vectors you get the vector connecting their endpoints. This is the one we want because it encodes both how much the line of sight changed (in it's length) and in what direction (the direction of the vector). This vector is the direction you want to rotate in, with a rotational speed proportional to it's length. You do the rotation by taking the cross product between the current LOS and the change in LOS (which gives a vector perpendicular to both of them) and taking this as a rotation axis.

Small note: To get the difference between the vectors for these purposes you need to normalise them. The LOS vector is in world space and if you don't normalise them before subtracting them it would also encode the missile closing speed to its target.

Good karma+1 vote
Boostback
Boostback - - 5 comments @ (GameDev) Introduction to Proportional Navigation (Part I)

Hey Xenonalex,
I think I figured out where I went wrong. I think with the method described here you first apply acceleration, get velocity from there and then get the rocket direction from the velocity direction. I approached things completely differently, I am simulating the missile as a real thing with only one acceleration source (It's main engine) and then working out which direction it needs to turn to hit it's target. Below is my working code for Proportional Navigation:Vector3 LOS = target.transform.position - transform.position;
Vector3 LOSGain = LOS.normalized - prevLOS.normalized;
float LOSAng = Vector3.Angle(transform.forward, LOS);

Vector3 perpVec = Vector3.Cross(LOS.normalized, LOSGain.normalized); //perpVec is perpindicular to both the LOS and the LOS change

float rotation_Speed = Mathf.Clamp(Mathf.Abs(LOSGain.magnitude * N), 0, maxAngCorr); //rotation_Speed = Omega * N (Clamped to maximum rotation speed)

if (LOSAng < 60)
{
Quaternion rot = Quaternion.AngleAxis(rotationSpeed, perpVec.normalized); // rotate with rotationSpeed around perpVec axis.
transform.rotation *= rot;
}
else
{
Vector3 newDirection = Vector3.RotateTowards(transform.forward, LOS, maxAngCorr*Mathf.Deg2Rad, 0.0f); //Turn towards target at maximum rotation speed
transform.rotation =
Quaternion.LookRotation(newDirection);
}

prevLOS = LOS;
Thanks for the help!

Good karma+2 votes
Boostback
Boostback - - 5 comments @ (GameDev) Introduction to Proportional Navigation (Part I)

Hey blahdy21,

I'm building missile guidance code in Unity as a personal project of mine. I have managed to nail down guidance in 3D in space by calculating the exact impact point. I have however found that this approach doesn't work on a planetary level with gravity and drag. I then stumbled upon your videos on APN and your blog.

I have been trying to implement APN for a while now but I can't seem to get it right. The point where I get stuck is what to do with the calculated required lateral acceleration, I have found a bazillion ways to calculate that acceleration in papers and in your videos but I don't know what to do with it. My main guess was:

Steering angle = Asin(required lateral acceleration / total missile acceleration)

But this just results in the missile going in a straight line because it gets in a feedback loop where it oscillates over a certain value. Could you maybe show or explain how you steer the missile with the calculated Latax?

Thanks in advance,
Boostback

Good karma+1 vote