playMaker

Author Topic: Checking whether a mesh is on screen  (Read 892 times)

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Checking whether a mesh is on screen
« on: June 30, 2019, 12:18:28 PM »
What would be the most effective way to check whether a thing is currently on screen? Basically for my sidescrolling game I want defeated enemies to explode if they hit the edge of the screen. It should also take FOV in consideration since it changes depending on the situation and player's action. I hope it's not too complicated to create.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Checking whether a mesh is on screen
« Reply #1 on: June 30, 2019, 01:45:11 PM »
Hi.
If they should be still visible and on the edge of the screen, i think i would place some triggers as child on the camera on the edges or near the edges.

these triggers can set a bool to true when object is inside the trigger and to false when not anymore inside trigger.
then something similar for the fov, if inside fov set bool true if not false.

Then have a bool all true to check if both are true, if both true....BOOM! :)

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Checking whether a mesh is on screen
« Reply #2 on: June 30, 2019, 02:22:40 PM »
That's the general idea. Parenting trigger boxes around to the camera is the easy part. I just don't really know how to make it handle the FOV detection. The dream scenario would be to simply have a simple box that grows and shrinks with the FOV and nothing else.

I'll keep experimenting. In my game it's not important to be pixel perfect detection anyway, so maybe I can find a similar solution from simpler methods.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Checking whether a mesh is on screen
« Reply #3 on: June 30, 2019, 04:04:20 PM »
Hi.
Maybe this video can help :


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Checking whether a mesh is on screen
« Reply #4 on: July 05, 2019, 10:32:50 AM »
Hi,

 There are few actions for this on the Ecosystem, like IsVisibleInCameraFrustrum

Bye,

 Jean