Gordon_G Posted February 19, 2017 Posted February 19, 2017 Hello, I know the event "onRadarAreaElementEnter" do not exist but, I would like to have something like this. In my script I've some radar area but I cant use any colshape (because I've some negatives lenghts) or zone because my areas are not the same than the zone. Could someone find a way to have an event like "onRadarAreaElementEnter" ? Thanks a lot !
Addlibs Posted February 19, 2017 Posted February 19, 2017 (edited) I'm pretty sure you can easily calculate the northwest position taking into account negative lengths using standard math, so a collision rectangle should do the job. Edited February 19, 2017 by MrTasty
Gordon_G Posted February 19, 2017 Author Posted February 19, 2017 (edited) I took my motivation and I did something like this to make easily colRectangle : col_rect = {} function colrect(source) x,y,z = getElementPosition(source) if col_rect.un == nil then table_ = {x,y} col_rect.un = table_ outputChatBox("1") elseif col_rect.deux == nil then table_ = {x,y} outputChatBox("2") col_rect.deux = table_ elseif col_rect.trois == nil then table_ = {x,y} outputChatBox("3") col_rect.trois = table_ local a = getDistanceBetweenPoints2D(col_rect.un[1],col_rect.un[2],col_rect.trois[1],col_rect.trois[2]) local b = getDistanceBetweenPoints2D(col_rect.un[1],col_rect.un[2],col_rect.deux[1],col_rect.deux[2]) local x,y = col_rect.un[1],col_rect.un[2] local w = a local h = math.sqrt(a^2-b^2) rect__ = createColRectangle(x,y,w,h) print(x..","..y..","..w..","..h) col_rect = {} end end addCommandHandler("rect",colrect) Thanks to everyone. Edited February 19, 2017 by Gordon_G
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