Open jaj22 opened 4 years ago
PATCOM add's a new safeSpawn script. Take a look and see if its something we want to use elsewhere.
PATCOM add's a new safeSpawn script. Take a look and see if its something we want to use elsewhere.
You mean getSafePos? Looks like a version of BIS_fnc_findSafePos. Not a fan generally because it can take a very long time in heavily-obstructed areas, but it really depends on what you're trying to spawn. safeSpawnPosition is more "we think there's probably empty space here but find exactly where".
Version: Unstable
Mods: Any
Environment: Any, although one point may be environment-sensitive
Issue:
Bug: The randomOffset generation has the brackets in the wrong place, which reduces the search area and gives the placement a strong bias towards +x/+y.
Conceptual flaw: Vehicles are frequently placed with a direction. safeVehicleSpawn doesn't take a direction, but vehicleWillCollideWithPosition depends on it. Therefore setting a vehicle's direction after calling safeVehicleSpawn will frequently cause explosions.
Conceptual flaw: Vehicles are frequently placed on roads. The radius search is inappropriate here, because if you make the radius large enough to avoid vehicles in the vicinity, vehicles are often placed blocked-in behind neighbouring walls, even if the central position was empty.
Arma bug: Calling createVehicle and setPos on the same vehicle in the same scheduled frame appears to bug out the AI such that they won't drive anywhere. They turn the steering wheel but don't start the engine. Working on a simpler replication case for this, but that's how it seems to work so far. Problematic because you can't get the bounding box without a created vehicle, so the method depends on it.