Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: serenefox on December 31, 2018, 09:34:15 PM
-
I decided to make a separate thread on this topic. I tried this action from the ecosystem but I soon figured out that the line cast is done in 3d physics and I need it for 2d. I tried to modify the script to work with 2D but I was unsuccessful. The documentation on the line cast doesn’t use “out” so I am unsure what to do.
Thanks!
-
Hi Shane,
Ok, I'll work on this. I'll ping you later on today when it's done.
Bye,
Jean
-
Awesome! Thanks Jean!
-
Hi,
ok, I edited the action and added a new option to use physics 2d, so please redownload from the ecosystem ( I moved the action from U4 to U5 repository as well).
Let me know how it goes, it works well for me here.
Bye,
Jean
-
Thanks Jean, I am having a problem though. I can't get the "closest Gameobject"'s value. It is always "none". With or without layermasks. I tried to use a debug.log but it didn't show up in the console either. Is there anyway to see what the linecast is hitting?
-
Hi,
It's odd, It all works fine here:
(https://i.imgur.com/0hSG3Jh.gif)
can you try an a test scene like me? you did put a 2d collider on your sprites right? and checked the "Use 2d physics" in the action?
Bye,
Jean
-
Hey Jean,
It works for me in a fresh scene but in my current game scene it must be blocked by something, which is why I was wondering if there was some way of testing what the ray/linecast is hitting. I also turned off “queries hit triggers” too and it still doesn’t work in my game scene. And yeah I do have 2d colliders and checked 2d physics.
-
Hi,
well, this is in "sight" so yeah, it means it has to be the first hit.
you need to first make sure what is blocking, and probably edit the physics collision matrix to avoid clashes between various 2d objects or yours. Organize your stuff by layers and make them ignore each other based on their context.
else, it would mean a different approach and a new action for that which would be more a regular GetClosestObject period, right?
Bye,
Jean
Bye,
Jean
-
Hi Jean,
I eventually had to give up on the action and did it like it is pictured in my image below, it works for me even though I am not getting the closest enemy in the array. I am not sure why its not working, as far as I know my 2D collision matrix is fine. Also there isn't even any collision boxes in between the AI and the enemy. Thank you for taking the time to help me though I really appreciate it!