Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: dudebxl on November 20, 2015, 12:04:23 PM

Title: Inside Collider Info
Post by: dudebxl on November 20, 2015, 12:04:23 PM
This might be useful for someone.

What does it do? It checks if the gameobject is inside (or partially inside) a collider. Useful for defining areas with colliders.

Example of usage:

Put a collider on an empty gameobject. Set the size of your collider.

1. Am I, a gameobject (renderer or sprite if 2d) inside this collider? Yes, send this event, No send this event.

2. Use with Array tool actions to check if a list of gameobjects are inside a list of colliders. Set a collider(s) as an FsmObject and loop.

on ecosystem or https://snipt.net/dudebxl/

3d version is tested. 2d Version not tested. Any problems, please post here.
Title: Re: Inside Collider Info
Post by: mdotstrange on November 20, 2015, 11:14:03 PM
Very useful! Thank you!
Title: Re: Inside Collider Info
Post by: 10high on October 28, 2021, 12:37:31 PM
I tried using the 2D version of this and it returns the error that it can't access the "Sprite" component on my GO because it doesn't have one.

So, I changed the script to work with "Renderer" instead. It seems to work as intended but perhaps someone else wants to see if anything else in the script needs updating. I literally changed just one line and me no code good can.

By the way, this action uses bounds, so it doesn't actually check whether the GO is inside the collider but whether it is inside the bounds. As I understand it, the bounds are rectangular, so if your collider isn't simply a rectangular shape the action can return an incorrect result.