keraunoscopia Posted August 14, 2015 Share Posted August 14, 2015 I'm designing an item which, upon use, spawns and places several stationary objects at random locations within a certain distance of the player. For the sake of example, let's say they're trees. I want to make sure they aren't placed in invalid locations (on top of a boulder or pond, in the ocean, etc.). Before I write code to check this myself, I'm wondering if there's an existing facility for this, something like IsValidLocation( x, y, z, ... ) Is there such a thing? Thanks in advance for your help! Link to comment Share on other sites More sharing options...
DarkXero Posted August 16, 2015 Share Posted August 16, 2015 (edited) @keraunoscopia,local can = TheWorld.Map:CanPlacePrefabFilteredAtPoint(x, y, z, prefab)x, y, z a world position (like inst.Transform:GetWorldPosition()).prefab being "berrybush", or "axe", for example. This is for ground types. For spacing between stuff:local can2 = TheWorld.Map:CanDeployRecipeAtPoint(pt, recipe)pt being a position (like inst:GetPosition()).recipe being a recipe, you want to leave it at nil to use the 3.2 min_spacing separator. Edited August 16, 2015 by DarkXero Link to comment Share on other sites More sharing options...
keraunoscopia Posted August 17, 2015 Author Share Posted August 17, 2015 @keraunoscopia,local can = TheWorld.Map:CanPlacePrefabFilteredAtPoint(x, y, z, prefab)x, y, z a world position (like inst.Transform:GetWorldPosition()).prefab being "berrybush", or "axe", for example. This is for ground types. For spacing between stuff:local can2 = TheWorld.Map:CanDeployRecipeAtPoint(pt, recipe)pt being a position (like inst:GetPosition()).recipe being a recipe, you want to leave it at nil to use the 3.2 min_spacing separator.Excellent - thanks very much for your response! Link to comment Share on other sites More sharing options...
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