To be honest, you're best to test using bounding boxes and the camera frustrum if you can get hold of those.
I've attached my code for generating the frustrum. You then should test each corner of your bounding box against this frustrum (code below).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void GenerateFrustumPlanes()
{
if (m_disableFrustrumUpdates)
return;
Matrix matrix;
// Create the frustum matrix from the view matrix and updated projection matrix.
matrix = m_wvp;
m_planes[0] = new Vector4(matrix.M13,
matrix.M23,
matrix.M33,
matrix.M43); // near
m_planes[1] = new Vector4(matrix.M14 - matrix.M13,
matrix.M24 - matrix.M23,
matrix.M34 - matrix.M33,
matrix.M44 - matrix.M43);
m_planes[2] = new Vector4(matrix.M14 + matrix.M11,
matrix.M24 + matrix.M21,
matrix.M34 + matrix.M31,
matrix.M44 + matrix.M41); // left
m_planes[3] = new Vector4(matrix.M14 - matrix.M11,
matrix.M24 - matrix.M21,
matrix.M34 - matrix.M31,
matrix.M44 - matrix.M41);//right
m_planes[4] = new Vector4(matrix.M14 - matrix.M12,
matrix.M24 - matrix.M22,
matrix.M34 - matrix.M32,
matrix.M44 - matrix.M42); // top
m_planes[5] = new Vector4(matrix.M14 + matrix.M12, matrix.M24 + matrix.M22, matrix.M34 + matrix.M32, matrix.M44 + matrix.M42); // bottom
for (int i = 0; i < s_frustrumPlanes; i++)
{
m_planes[i].Normalize();
}
}
code to test the points of the bbox against the frustrum.
public bool IsInViewableArea(List a_cornerLIst)
{
// this is a simpler occlusion test where we basically dont even need to test frustrum as the the extents are outside the camera view distance. But you need to test extents + width because we only hold 2 corners and squares are 4
int iTotalIn = 0;
Vector4[] pList = GetFrustumPlanes(); // this should only be called once.
// test all 8 corners against the 6 sides
// if all points are behind 1 specific plane, we are out
// if we are in with all points, then we are fully in
Vector4 temp;
float dotvector;
for (int p = 0; p < Camera3d.s_frustrumPlanes; ++p)
{
int iInCount = 8;
int iPtIn = 1;
for (int i = 0; i < a_cornerLIst.Count; ++i)
{
//Vector3 a = pList[i].
// test this point against the planes
// if (pList[p].SideOfPlane(vList[i]) == BEHIND)
//Vector4.Dot()
temp = (Vector4)(a_cornerLIst[i] );
temp.W = 1;
dotvector = Vector4.Dot(pList[p], temp);
if (dotvector < 0.0f)
{
iPtIn = 0;
--iInCount;
}
}
// were all the points outside of plane p?
if (iInCount == 0)
{
return false;
}
// check if they were all on the right side of the plane
iTotalIn += iPtIn;
}
// so if iTotalIn is 6, then all are inside the view
// if (iTotalIn == 6)
// return true;
// we must be partly in then otherwise
return true;
}