Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Sly on August 04, 2014, 10:01:22 AM
-
Hello,
I'm still making my top view 2d game.
I'm actually making the door system for it but I have some trouble.
I check a lot's of tutorial and I know how to make the basic for it.
But for for my kind of game I need the player to look at the door direction and be in the triggerzone.
How I can check if the player is checking in a certain direction/looking at the door? So the player can press "E" to open it.
Because I don't want him to be able to open a door from behind.
Thanks in advance
-
Maybe you can use a Raycast on the Player, so the Raycast needs to hit the door before you are able to open it.
-
Yes I was thinking about raycast, but I try to avoid it because my enemies already have use some. I don't know if it's taking too much performance.
I just wonder if there is other way to do it.
-
I don't know if Raycast taking too much performance. Maybe Jean Fabre or some other experts can answer this. :)
Maybe you can have a collision trigger or something in the front of the player which is a child. And when this trigger collides with the door, you can open it.
-
Hello
Maybe you can have a collision trigger or something in the front of the player which is a child. And when this trigger collides with the door, you can open it.
^This or Raycast
If many objects use Raycast every frame it can take performance, but here - you can just shoot 1 ray(Set Repeat Interval to "0") when a Key is pressed. Then check if that object is a "door" or not and react.
I use it for car doors and pick up stuff.
-
Then go for Raycast. :)
-
Yo!
Thanks for your ideas guys! They are good for solve my problem.
I will try with the raycast using repeat interval set to 0 when press a key, like you suggest 600.
Thank you very much!
-
Ok, I did it with the raycast once the action button is triggered.
My player "communicate" with the items is facing, if it's at a correct range.
The only problem is when my door is opened, I can't target it because there is no more collision, but I fixed it by adding a box collider triggerzone. So I can target even if the triggerzone don't do anything.
+My door is destructible :)
Thanks for the good ideas, thanks to playmaker awesome community!
Have a good one!
-
Nice that you fixed it. :)