Dimitri Stupakis Posted July 1, 2020 Posted July 1, 2020 Hello, I created a garage with multiple parkout points and I want to check if a spawnpoint is blocked by something (car) or not before spawn it. Does anyone knows how to find out whether a specific position is blocked by an object or not?? I tried it with raycasting which works but therefore a huge amount of positions needs to be set and sometimes based on the size of the vehicle it doesn't hit it... I also tried to check it out by checking all owned vehicles but it always says "parking positions blocked"... :( bool freeSpawnAvailable = false; GarageSpawn freespawn = null; garage.Spawnpoints.ForEach(spawn => { if (!freeSpawnAvailable) { for (int i = 0; i < VehicleService.GarageService.OwnedVehiclesList.Count; i++) { OwnedVehicles blockingveh = VehicleService.GarageService.OwnedVehiclesList; if (blockingveh.ActiveHandle != null) { if (blockingveh.ActiveHandle.Position.DistanceTo(spawn.Position) <= 4f) { freeSpawnAvailable = false; } } else { freeSpawnAvailable = true; freespawn = spawn; } } if (freespawn == null) { c.SendNotification("~r~Kein freier Ausparkpunkt!"); return; } Any ideas ?? Thanks a lot upfront for tipps, hints or example.
M4ybe Posted July 3, 2020 Posted July 3, 2020 create list with struct parking position type free or non free and use Method Find for find first index with type free
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now