Hi
I use SSK2 camera with the tracking mode.
I there any way to know if an object is outside the visible part of the world?
Best Answer roaminggamer , 26 February 2018 - 04:52 PM
Sure, it would be something like this:
local function isInView( obj, player ) local xMin = player.x - fullw/2 local xMax = player.x + fullw/2 local yMin = player.y - fullh/2 local yMax = player.y + fullh/2 if( obj.x > xMax ) then return false end if( obj.x < xMin ) then return false end if( obj.y > yMax ) then return false end if( obj.y < yMin ) then return false end return true end
Hi
I use SSK2 camera with the tracking mode.
I there any way to know if an object is outside the visible part of the world?
Best Answer
Sure, it would be something like this:
local function isInView( obj, player ) local xMin = player.x - fullw/2 local xMax = player.x + fullw/2 local yMin = player.y - fullh/2 local yMax = player.y + fullh/2 if( obj.x > xMax ) then return false end if( obj.x < xMin ) then return false end if( obj.y > yMax ) then return false end if( obj.y < yMin ) then return false end return true end