Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: darrkbeast on November 11, 2013, 02:42:55 PM

Title: 2d ai direction check - SOLVED
Post by: darrkbeast on November 11, 2013, 02:42:55 PM
I cant seem to locate a action to help me with this. I may have over looked it, or searched wrong. What I want to do is change my sprite depending on which direction the NPC is going. I am working on the x/z only. Also the npc's work off a script, no physical input from me.

I really only need a action of set off them that first picks up on the npcs movement, and then sends a event based of their movement. Axis Raw Input would work perfect if there was a way to translate the npcs movement into a variable it could use.

Thanks for any help that is available.


UPDATE
(I found the vector compare action in the forum and it allowed me to get what I needed.)
Title: Re: 2d ai direction check
Post by: Mayhem on November 11, 2013, 03:38:38 PM
Here is just an ideas what you could do:

- assuming your NPC moves left/right you could give him an int variable "i_Direction" and handle it like this:
 -> when NPC moves to left set it to -1
 -> when NPC moves to the right set it to 1
 -> when NPC doesn't move at all set it to 0
- with this variable you can determine which direction the NPC is facing
and do your other stuff
Title: Re: 2d ai direction check
Post by: darrkbeast on November 11, 2013, 04:54:24 PM
That makes since, but how do I get which direction the npc moves. I use A Star with playmaker plug in, so my npc locates target and heads there, but I don't see a way to store the directions the nps going. If I can do that, what you describe would work great. Oh he moves up, down, left and right on the x,z plans.
Title: Re: 2d ai direction check
Post by: darrkbeast on November 12, 2013, 09:48:36 AM
Ive been reading some forums and I think I will try to use Get Velocity action. I think that will get me the direction so I can store it and compare it, then I can use a the method you mentioned mayhem. As soon as I get home Ill try this, from looking into that action I think its what I need.