mrvicio Posted December 2, 2011 Share Posted December 2, 2011 hi all, there is a way to get the elements near a player without using a colShape? Link to comment
Castillo Posted December 2, 2011 Share Posted December 2, 2011 Why don't you want to use a colshape? what's wrong with them? Link to comment
mrvicio Posted December 2, 2011 Author Share Posted December 2, 2011 nothing, just asking if there are better ways but thanks Link to comment
arezu Posted December 2, 2011 Share Posted December 2, 2011 getDistanceBetweenPoints3D or getDistanceBetweenPoints2D Link to comment
mrvicio Posted December 2, 2011 Author Share Posted December 2, 2011 thanks my friend, but that will be the second step Link to comment
Kenix Posted December 2, 2011 Share Posted December 2, 2011 Function: getElementsInRadius table getElementsInRadius( float Radius,element toEl,[ string el ] ) Required Arguments Radius:Radius. toEl:Element Optional Arguments el:Elements are in the distance ("player", "object" etc) to see.. Return Returns a table with elements that are in range. function getElementsInRadius( Radius,toEl,el ) if type( Radius ) == "number" and type( toEl ) == "userdata" then local Table = { } local x,y,_ = getElementPosition( toEl ) local shape = createColCircle ( x,y,Radius ) local function _getElementsWithinColShape ( shape,el ) if not el then return getElementsWithinColShape( shape ) end return getElementsWithinColShape( shape,el ) end for _,v in ipairs( _getElementsWithinColShape( shape,el ) ) do table.insert( Table,v ) end return Table end return false end Link to comment
Castillo Posted December 2, 2011 Share Posted December 2, 2011 Kenix, he asked without using colshapes, but anyway, I guess he may use it . Link to comment
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