Defining a plane using three points?
This adds to another thread but is for a different reason thus another thread.
I'm afraid I do not understand this statement from the first link:
Since the general equation of a plane is:
Notice how we are defining the plane by three passing points. Thus, the plane is vertical, and its normal is pointing to the left side of the world, as seen from the local player position.
ax+by+cz+d=0 or ax+by+cz=d (whichever you choose)
And the constructor options for D3DXPLANE are:
How do I construct a plane with only 3 points? Where is d?
D3DXPLANE( CONST FLOAT* );
D3DXPLANE( CONST D3DXFLOAT16* );
D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d );
I found the answer. Sorry.
I'm going to use this to allow the AI space ships to follow waypoints, targets, and the player during battles. The code finds out which quadrant the target object is in and adjusts pitch and yaw respectively. I was going to use vector LERP but I have not converted to quaternions and using Euler's is such a PITA.
D3DXPLANE * D3DXPlaneFromPoints(
D3DXPLANE * pOut,
CONST D3DXVECTOR3 * pV1,
CONST D3DXVECTOR3 * pV2,
CONST D3DXVECTOR3 * pV3
I'm using vector LERP for auto-pilot tracking and target tracking using:
void VectorLERP(D3DXVECTOR3 &result,D3DXVECTOR3 v1,D3DXVECTOR3 v2,float lerp)