Skip to content

Improve spawning position #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DreamersIncStudios opened this issue Apr 24, 2020 · 1 comment
Open

Improve spawning position #3

DreamersIncStudios opened this issue Apr 24, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@DreamersIncStudios
Copy link
Owner

Improve Spawner System by either doing a downward ray cast or getting navmesh position to determine floor position. Adding a Vertical offset to the spawn SO. This will make sure the spawned GO always instantiates are appropriate height

@DreamersIncStudios DreamersIncStudios added the enhancement New feature or request label Apr 24, 2020
@DreamersIncStudios DreamersIncStudios self-assigned this Apr 24, 2020
@DreamersIncStudios
Copy link
Owner Author

Code below does not function as expected in ComponentSystem.

 bool RandomPoint(Vector3 center, float range, out Vector3 result)
        {
            for (int i = 0; i < 30; i++)
            {
                Vector3 randomPoint = center + UnityEngine.Random.insideUnitSphere * range;
                NavMeshHit hit;
                if (NavMesh.SamplePosition(randomPoint, out hit, 1.0f, NavMesh.AllAreas))
                {
                    result = hit.position;
                    return true;
                }
            }
            result = Vector3.zero;
            return false;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant