Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: 4ppleseed on March 09, 2014, 05:57:09 PM
-
Is there a trick to this?? I can add a cube and use the normal 3D raycast and the debug line works as expected but when I try to do it with Ray Cast 2D - I can't get any debug line to show. Is it broken?
Thanks.
-
Or maybe it needs to be a certain collision type or object to work in 2D? I'm lost... :o
-
Hi,
First, everything as to be 2d, you can't mix 3d physics and 2d physics, can you double check this?
bye,
Jean
-
Yeah, I've double checked and still can't get it to work.
Lets say I have a sprite with rigidbody and box Collider 2d with Raycast2D attached. On hitEvent, I store the Object hit and moved to a Game Object Compare Tag. This looks for the Tag 'Player'. If it's not hit a Player tag, it waits for 1 second and tries again. If it does hit 'Player' Tag it should do something different but it never does.
Does Raycast2D not work with Game Object Compare Tag? Or Sprite?
If I add a cube child to the Sprites and use Raycast3D into Game Object Compare - it will work.
-
Hi,
You are likely not firing the ray as you imagine you do,
"Game object compare tag" works in all situations, so it's likely that the Raycast2D is not finding anything to begin with.
I doubled checked and everything is working as expected.
can you debug the ray ( check the "debug" option in the action") and make sure you see a yellow line in the scene view that is exactly what you expect the raycast to be, if you don't see that yellow line, then it's your setup that is wrong.
bye,
Jean
-
Yeah, I can see the yellow line. I'll make up a quick scene and attach it - I know it's just me being dumb haha.
-
I am having the same problem, same set up, for some reason my Raycast hit my NPC Game Object, at all times, and never hits the player even if it's right infront of it.
The NPC is Untagged as well.
The Has the tag Player
-
Hi,
when things like that do not work as expected, make a new scene with just one object and try to raycast on it, then work from there. It's likely a mix of issues and setup that leads to a malfunctionning behavior.
Bye,
Jean