playMaker

Author Topic: GameObject Visible In Camera Frustum  (Read 6006 times)

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • View Profile
    • My Blog
GameObject Visible In Camera Frustum
« on: September 21, 2014, 07:01:26 AM »


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.



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.
« Last Edit: September 22, 2014, 11:54:17 AM by TrentSterling »

rik

  • Full Member
  • ***
  • Posts: 246
    • View Profile
Re: GameObject Visible In Camera Frustum
« Reply #1 on: December 07, 2014, 07:18:51 AM »
i was looking for the same

Twood

  • Playmaker Newbie
  • *
  • Posts: 27
    • View Profile
Re: GameObject Visible In Camera Frustum
« Reply #2 on: October 13, 2015, 10:33:37 AM »
Nice one! Should go in the ecosystem imo.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15330
  • Official Playmaker Support
    • View Profile
Re: GameObject Visible In Camera Frustum
« Reply #3 on: October 16, 2015, 06:49:44 AM »
Hi,

 It's on the Ecosystem now



Bye,

 Jean

Twood

  • Playmaker Newbie
  • *
  • Posts: 27
    • View Profile
Re: GameObject Visible In Camera Frustum
« Reply #4 on: October 17, 2015, 05:06:02 PM »
Very nice! Thanks!

moondust.games

  • Playmaker Newbie
  • *
  • Posts: 44
    • View Profile
Re: GameObject Visible In Camera Frustum
« Reply #5 on: February 04, 2016, 04:57:07 AM »
Thanks for that!

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1057
    • View Profile
    • Fat Pug Studio
Re: GameObject Visible In Camera Frustum
« Reply #6 on: February 03, 2020, 03: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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15330
  • Official Playmaker Support
    • View Profile
Re: GameObject Visible In Camera Frustum
« Reply #7 on: February 04, 2020, 03: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

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1057
    • View Profile
    • Fat Pug Studio
Re: GameObject Visible In Camera Frustum
« Reply #8 on: February 05, 2020, 03:39:06 AM »
Thanks Jean, works great, 0.0kb of garbage :)