Created
September 27, 2011 07:18
-
-
Save ghiboz/1244517 to your computer and use it in GitHub Desktop.
RayTrace in MogreNewt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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