Einlander Posted August 8, 2015 Share Posted August 8, 2015 I've been making a AI spawning system and I'm finding that there are situations where the spawn location ends up in another entity. I would like to be able to programmatically detect this and move the spawn location. How would I go about this? Quote Link to comment Share on other sites More sharing options...
Slastraf Posted August 8, 2015 Share Posted August 8, 2015 i taught of this : get all positions of all entities as a vec3 and then check for x and z . if those are equalling under (for example 10) then add a new random value to the spawning point. all this before a new monster gets spawned and make sure the things above get checked as often as if there isnt an other entity around. Quote Link to comment Share on other sites More sharing options...
shadmar Posted August 8, 2015 Share Posted August 8, 2015 Hi, you should be able to use these to detect this: http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitygetaabb-r169 http://www.leadwerks.com/werkspace/page/api-reference/_/aabb/aabbintersectsaabb-r609 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Einlander Posted August 8, 2015 Author Share Posted August 8, 2015 After some leaps of faith I have come up with a fascinating solution. I used the GetEntityNeighbors.lua file found in the functions folder. I set the entity as itself (i'm using a pivot), with a radius of 0 and false for the scripts parameter. Sadly this will only tell you the outermost object of what you are in. So if you walk in a building in your game, it will return the building entity. Is there a way to return the innermost entity you are in, if you are in one? For you place an entity inside a box, that's inside a safe? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.