hi!
hi have a question about trigger...
i want to make visibile an object(with "remember visibility") when my player enter in a "trigger" but only if the direction of my player are "walking_L" ( this becouse i want active that, only when the player enter by left side, and not when are by right side.)
is this possible or i have to build my own code?
Comments
I don't think it's possible to ask the direction of a character right now, maybe if there is a way using mecanim... and obviously with custom code everything is possible, but you can achieve this using triggers and a local variable... to know if the character enters by the left side you could just use 2 triggers, side by side...
Character -> [Left Trigger][ Visibility Trigger ]
The Left Trigger could call an actionlist that activates a flag... EnteredLeft = true... and if entering the Visibility Trigger you could ask if EnteredLeft is true before making that object visible. Remember to restart EnteredLeft = false, every time you get out the Visibility Trigger if you want to do that again.
For full directions... you could have 3 more triggers (or a big one that covers the rest of triggers) like a cross :
[ Up -> EnteredLeft = false ]
[Left -> EnteredLeft = true] [Visibility -> Is EnteredLeft?] [Right -> EnteredLeft = false]
[ Down-> EnteredLeft = false ]
Hope it helps...
In script, you can get a 2D character's direction with the NPC / Player script's GetSpriteDirection () function. Left will return "_L", right "_R" and so on.