Skip to content

Instantly share code, notes, and snippets.

@ghiboz
Created September 27, 2011 07:18
Show Gist options
  • Save ghiboz/1244517 to your computer and use it in GitHub Desktop.
Save ghiboz/1244517 to your computer and use it in GitHub Desktop.
RayTrace in MogreNewt
public float RayTrace(Vector3 position)
{
Vector3 start = position;
Vector3 end = position;
start.z = start.z + 20F;
end.z = end.z - 20F;
BasicRaycast ray = new BasicRaycast(m_World, start, end);
if (ray.FirstHit != null)
{
float fRet = ray.FirstHit.mDistance;
return position.z + ( (fRet * 40F) - 20F);
}
return 0F;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment