playMaker

Author Topic: Problem with "is visible in camera frustum" action [SOLVED]  (Read 1791 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Problem with "is visible in camera frustum" action [SOLVED]
« on: November 24, 2017, 01:16:42 PM »
Hello,

I'm using this action a lot in my project since it's a lot better than default VISIBLE/NOT VISIBLE actions which take the scene view into consideration too, so i can enter the play mode without maximizing the window and see what's happening outside the frustum.

I've got some objects that spawn outside frustum, start moving and upon entering the frustum activate their children, submodules etc. There are many reasons for that, from getting exact count of enemies on screen, over avoiding firing from outside the screen and finally for deactivating the object when it leaves the screen.

It served me well until today. I'm using a templated FSM for configuring the whole object which contains the aforementioned action that activates a set of states upon entering frustum, and deactivates them when the object exits. But, as i applied it to two new object today, they are detected as visible in frustum when they enter it and then, when they pass the few states (matter of few frames perhaps), they are immediately detected as not visible and deactivated. They basically don't even enter the frustum, it's like they hit the frustum edge and disappear.

The only difference between objects used before and these ones is speed. The ones set to 0.8f and 0.4f work as intended, but these are 0.2f.

Is it somehow possible that they are too slow and they somehow jitter around and enter and exit the frustum? I use translate with fixed update, so that shouldn't be a problem, but nothing else comes to my mind.

« Last Edit: November 24, 2017, 03:31:07 PM by krmko »
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Problem with "is visible in camera frustum" action
« Reply #1 on: November 24, 2017, 03:07:07 PM »
Hi,
I have not used this action yet, but maybe you can try to set a next frame event in between the enter/exit state

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Problem with "is visible in camera frustum" action [SOLVED]
« Reply #2 on: November 24, 2017, 04:01:38 PM »
I solved it, and you won't believe the stupidity of the situation. Those two prefabs i spawn are the same, but one is rotated along y axis (it's upside down). I could swear that i had the group instance with two same named objects, only one of them set to -1 Y scale. The group i was testing had PrefabName and ReversePrefabName, i probably took some old prefab version. The thing is, once the object enters the frustum, it pulls HP data from hash table, and then goes to wait for collision/wait for frustum exit state. Since the prefab name is wrong, it draws 0 HP from the hash table and is immediately destroyed. But what about the other? Well, when the first one is destroyed, the screen shakes just enough on the horizontal scale to put the remaining one out of frustum again and destroy it.

What a show.
« Last Edit: November 24, 2017, 04:03:19 PM by krmko »
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Problem with "is visible in camera frustum" action [SOLVED]
« Reply #3 on: November 24, 2017, 04:05:58 PM »
Time for a good night rest? :P

or a good night with lots of beer  8) (or other drinks)

anyway happy you found the issue :D

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Problem with "is visible in camera frustum" action [SOLVED]
« Reply #4 on: November 24, 2017, 07:34:12 PM »
Ah yes, beer helped, now some sleep  ;D
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Problem with "is visible in camera frustum" action [SOLVED]
« Reply #5 on: November 25, 2017, 05:04:03 PM »
My turn tonight!

Lots of beer, dancing (behind my light controler) and a good sleep afterwards.  8) 8) 8)