Exemplo n.º 1
0
        public override void SolverUpdate()
        {
            // Pass-through by default
            GoalPosition = WorkingPosition;
            GoalRotation = WorkingRotation;

            // Determine raycast params. Update struct to skip instantiation
            Vector3 origin   = RaycastOrigin;
            Vector3 endpoint = RaycastEndPoint;

            currentRayStep.UpdateRayStep(ref origin, ref endpoint);

            // Skip if there isn't a valid direction
            if (currentRayStep.Direction == Vector3.zero)
            {
                return;
            }

            switch (RaycastMode)
            {
            case SceneQueryType.SimpleRaycast:
                SimpleRaycastStepUpdate(ref this.currentRayStep);
                break;

            case SceneQueryType.BoxRaycast:
                BoxRaycastStepUpdate(ref this.currentRayStep);
                break;

            case SceneQueryType.SphereCast:
                SphereRaycastStepUpdate(ref this.currentRayStep);
                break;
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override void SolverUpdate()
        {
            // Pass-through by default
            GoalPosition = WorkingPosition;
            GoalRotation = WorkingRotation;

            // Determine raycast params. Update struct to skip instantiation
            Vector3 origin   = RaycastOrigin;
            Vector3 endpoint = RaycastEndPoint;

            currentRayStep.UpdateRayStep(ref origin, ref endpoint);

            // Skip if there isn't a valid direction
            if (currentRayStep.Direction == Vector3.zero)
            {
                return;
            }

            if (DebugEnabled)
            {
                Debug.DrawLine(currentRayStep.Origin, currentRayStep.Terminus, Color.magenta);
            }

            switch (RaycastMode)
            {
            case SceneQueryType.SimpleRaycast:
                SimpleRaycastStepUpdate(ref this.currentRayStep);
                break;

            case SceneQueryType.BoxRaycast:
                BoxRaycastStepUpdate(ref this.currentRayStep);
                break;

            case SceneQueryType.SphereCast:
                SphereRaycastStepUpdate(ref this.currentRayStep);
                break;

            case SceneQueryType.SphereOverlap:
                Debug.LogError("Raycast mode set to SphereOverlap which is not valid for SurfaceMagnetism component. Disabling update solvers...");
                SolverHandler.UpdateSolvers = false;
                break;
            }
        }