Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: TrentSterling on September 21, 2014, 10:01:26 AM

Title: GameObject Visible In Camera Frustum
Post by: TrentSterling on September 21, 2014, 10:01:26 AM
(http://i.imgur.com/zUFyofz.gif)

GameObject.renderer.isVisible doesn't work when an object casts dynamic shadows. This makes the GameObjectIsVisible action useless in any application with shadows enabled.

Here's a replacement action that test's if the object's renderer bounds are within the Main camera's frustum planes.

(http://i.imgur.com/dSj1d8d.png)

Based off a code snippet from here:
http://forum.unity3d.com/threads/is-target-in-view-frustum.86136/#post-626470

EDIT: I misspelled Frustum everywhere. It's not 'Frustrum' ha. Uploaded corrected class name and whatnot. God I feel dumb for that. Shoulda just called it viewport. Would have saved myself from the endless corrections here and my site and on youtube.
Title: Re: GameObject Visible In Camera Frustum
Post by: rik on December 07, 2014, 09:18:51 AM
i was looking for the same
Title: Re: GameObject Visible In Camera Frustum
Post by: Twood on October 13, 2015, 01:33:37 PM
Nice one! Should go in the ecosystem imo.
Title: Re: GameObject Visible In Camera Frustum
Post by: jeanfabre on October 16, 2015, 09:49:44 AM
Hi,

 It's on the Ecosystem now

(https://pbs.twimg.com/media/CRcW-LxXIAAR56A.png)

Bye,

 Jean
Title: Re: GameObject Visible In Camera Frustum
Post by: Twood on October 17, 2015, 08:06:02 PM
Very nice! Thanks!
Title: Re: GameObject Visible In Camera Frustum
Post by: moondust.games on February 04, 2016, 06:57:07 AM
Thanks for that!
Title: Re: GameObject Visible In Camera Frustum
Post by: Fat Pug Studio on February 03, 2020, 05:34:26 PM
Hey guys,

can some of the more experienced programmers take a look at this action, it's creating a lot of GC?
Title: Re: GameObject Visible In Camera Frustum
Post by: jeanfabre on February 04, 2020, 05:42:30 AM
Hi,

 This action is on the Ecosystem (IsVisibleInCameraFrustrum). I just updated it to remove as much GC as possible, it will be even better starting 2017.3 as Unity made a GC free version of the frustrum planes api command.

So update the action from the ecosystem and use that one instead of the one attached to the first post of this thread.

 Let me know if you see an improvement.

Bye,

 Jean
Title: Re: GameObject Visible In Camera Frustum
Post by: Fat Pug Studio on February 05, 2020, 05:39:06 AM
Thanks Jean, works great, 0.0kb of garbage :)
Title: Re: GameObject Visible In Camera Frustum
Post by: Silicon Power on February 03, 2022, 07:42:18 AM
(http://i.imgur.com/zUFyofz.gif)

GameObject.renderer.isVisible doesn't work when an object casts dynamic shadows. This makes the GameObjectIsVisible action useless in any application with shadows enabled.

Here's a replacement action that test's if the object's renderer bounds are within the Main camera's frustum planes.

(http://i.imgur.com/dSj1d8d.png)

Based off a code snippet from here:
http://forum.unity3d.com/threads/is-target-in-view-frustum.86136/#post-626470

EDIT: I misspelled Frustum everywhere. It's not 'Frustrum' ha. Uploaded corrected class name and whatnot. God I feel dumb for that. Shoulda just called it viewport. Would have saved myself from the endless corrections here and my site and on youtube.

Hi thank you. What about objects behind a wall? can it still be seen?