示例#1
0
文件: Geo3D.cs 项目: Zipcore/7Dmods
 public static Vector3 directionLook(EntityPlayer player) {
     // Vector3 intersect = intersectLook(player);
     // return (intersect - player.position).normalized;
     Ray lookRay = player.GetLookRay();
     Vector3 dx = lookRay.direction;
     return dx.normalized;
 }
示例#2
0
        public static Vector3i GetBlockPlayerLookingAtPos(EntityPlayer player)
        {
            for (int distance = 0; distance <= 1000; distance++)
            {
                Vector3    lookPoint = player.GetLookRay().GetPoint(distance);
                Vector3i   lookVec   = new Vector3i(lookPoint.x, lookPoint.y, lookPoint.z);
                BlockValue bv        = BlockUtils.GetBlock(lookVec.x, lookVec.y, lookVec.z);
                if (bv.type != BlockValue.Air.type)
                {
                    Log.Out(distance.ToString());
                    return(lookVec);
                }
            }

            return(Vector3i.zero);
        }
示例#3
0
        public static BlockValue GetBlockPlayerLookingAt(EntityPlayer player)
        {
            for (int distance = 0; distance <= 100; distance++)
            {
                Vector3    lookPoint = player.GetLookRay().GetPoint(distance);
                Vector3i   lookVec   = new Vector3i(lookPoint.x, lookPoint.y, lookPoint.z);
                BlockValue bv        = BlockUtils.GetBlock(lookVec.x, lookVec.y, lookVec.z);

                if (bv.type != BlockValue.Air.type)
                {
                    return(bv);
                }
            }

            return(BlockValue.Air);
        }
示例#4
0
文件: Geo3D.cs 项目: Zipcore/7Dmods
    /* I have seen GameManager.Instance.World.GetTerrainHeight(start.x, start.z) fail and return 0 !

	*/

	public static Vector3 intersectLook(EntityPlayer player) { //  'Entity' does not contain a definition for 'GetLookRay', so not for Zs ?
        // EntityPlayer player = GameManager.Instance.World.GetLocalPlayer(); // : 'World' does not contain a definition for 'GetLocalPlayer' 
        Ray lookRay = player.GetLookRay();
        if (Voxel.Raycast(GameManager.Instance.World, lookRay, 5000f, 65536, 64, 0f)) return Voxel.voxelRayHitInfo.hit.pos;
        else return player.position;
    }