Sign in to follow this  
maximumdrive

[HELP] Detect 'neighbor-staying' colshapes (private area system)

Recommended Posts

Posted (edited)

Hi all,

I'm on my way to make a kind of a 'private-area' system. Everything is fine with creating both of createColRectangle()+createRadarArea(), but how do I avoid matching/crossing existing areas with a newly created one?

I tried to implement it via getElementsWithinRange() being based on colRectangle's position and it's size as a range-argument, but it wasn't successful, because it detects all the areas in range ignoring the scaling direction. E.g. I couldn't create a colshape longer because there was a colshape on the left or wider because there was a colshape 'above'.

There is a 'table-organized' variant if it helps. All the coordinates are 'demo', because originally everything is set dynamically.

areaShapes[areaID] = { 
		["details"] = {
                  ["x"] = 318.4215,
                  ["y"] = 1027.973,
                  ["z"] = 14.25,
                  ["sizeX"] = 25,
                  ["sizeY"] = 20,
    		},
		["square"] = 500,
		["area"] = createdColShapeElement,
		["radarArea"] = radarAreaElement,
		["onHit"] = addEventHandler ( "onColShapeHit", createdColShapeElement, hitArea ),
		["onLeave"] = addEventHandler ( "onColShapeLeave", createdColShapeElement, leaveArea ),
	}

 

Any ideas?

Edited by maximumdrive

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.