Jump to content

Is it possible to tell if a coordinate location contains a building?


Recommended Posts

Posted

Say I wanted to spawn a vech at a random location , is it possible to check the coords I want to use to see if a building exists there ?

 

Just want to make sure I do not spawn on top of a building

No more pre-orders

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Posted

was hoping for a scripted solution ... still working on this and trying

No more pre-orders

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Posted (edited)

I guess you could create a zone around the building (MOOSE allows you to set inner and outer zone radius for several methods) and get a random coordinate from it, which you could use to spawn the unit/group.

 

Here's a MOOSE script example:

 

 

local Spawn_Zone = ZONE:New("Zone name in ME")

local Random_Point = Spawn_Zone:GetRandomPointVec2(inner radius in meters, outer radius in meters) -- Set the desired inner and outer radius of the zone, from which to get the random spawn point

 

local Group_Spawn = SPAWN:New("name of the late activated group in ME")

Group_Spawn:SpawnFromPointVec2(Random_Point)

 

 

If you want to do this for hundreds of buildings, though, I don't think this is a realistic solution :D

Edited by Hardcard
Posted

You can use world.searchObjects() to return all objects near a given point. If no object is returned then the area is clear. There are a few issues potentially with doing that however. First among which is that the size and shape of the object isn't fully known. Some objects don't have a "box" defined of the overall area they take up, and that box value isn't useful for odd shaped objects. Additionally not all objects are returned, like trees, bushes, and assorted other objects. Last of all it is "expensive" to compute as searching a large area can have hundreds if not thousands of objects returned.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
I guess you could create a zone around the building (MOOSE allows you to set inner and outer zone radius for several methods) and get a random coordinate from it, which you could use to spawn the unit/group.

 

Here's a MOOSE script example:

 

 

local Spawn_Zone = ZONE:New("Zone name in ME")

local Random_Point = Spawn_Zone:GetRandomPointVec2(inner radius in meters, outer radius in meters) -- Set the desired inner and outer radius of the zone, from which to get the random spawn point

 

local Group_Spawn = SPAWN:New("name of the late activated group in ME")

Group_Spawn:SpawnFromPointVec2(Random_Point)

 

 

If you want to do this for hundreds of buildings, though, I don't think this is a realistic solution :D

Thanks , this method would not work well

 

You can use world.searchObjects() to return all objects near a given point. If no object is returned then the area is clear. There are a few issues potentially with doing that however. First among which is that the size and shape of the object isn't fully known. Some objects don't have a "box" defined of the overall area they take up, and that box value isn't useful for odd shaped objects. Additionally not all objects are returned, like trees, bushes, and assorted other objects. Last of all it is "expensive" to compute as searching a large area can have hundreds if not thousands of objects returned.

 

 

Thanks for the tip Grimes managed to figure out a quick n dirty solution to this problem

No more pre-orders

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...