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?
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?
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
Thank you!
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
Thank you!