Пример #1
0
        /// <summary>
        /// 从玩家手上到预定drop点连线,判断中间是否有物体阻挡
        /// </summary>
        /// <param name="playerEntity"></param>
        /// <param name="hitInfo"></param>
        /// <param name="specifiedRaycast"></param>
        /// <returns></returns>
        public static bool RaycastPlayerDropObject(PlayerEntity playerEntity, Vector3?dropPos, out RaycastHit hitInfo, RaycastDel specifiedRaycast = null)
        {
            specifiedRaycast = specifiedRaycast ?? defaultRaycast;
            var handPosVal = SceneObjectPositionUtil.GetHandObjectPosition(playerEntity);
            var dropPosVal = dropPos.HasValue?dropPos.Value: SceneObjectPositionUtil.GetPlayerDropPos(playerEntity);

            return(specifiedRaycast(handPosVal, dropPosVal - handPosVal, out hitInfo, Vector3.Distance(handPosVal, dropPosVal),
                                    dropLayer));
        }