I am working on making a 2.5D FPS game with a similar aesthetic to Doom. I’ve been searching all over the place on how to get the effect to work with blueprints and even just the general theory on how it works and I’m struggling to come up with results. I am trying to have my enemy sprite flip through sprites depending on the direction they are currently facing like they do in Doom and other 2.5d fps games. Example on youtube I found of what I mean. Any help or guidance on how to pull this off with blueprints would be greatly appreciated!
Ok, so you have a character BP which contains a sprite. You can change the material of the sprite depending on orientation with respect to the player.
Each material can be a flipbook to accomodate motion.
What would the algorithm for determining the enemies orientation in respects to players current position look like. I’m struggling to find a way to translate that kind of information between the enemy sprite and player character.
So the enemy BP is always looking at it’s rotation with respect to the player camera:
Something like that, haven’t tried it at all… But a line from the player to the BP and the angle of the BP with repsect to that line…
I’ll give this a try when I get home, what I’m getting at is it’s getting the world difference between the actor and the player and then getting the angle between that and the current forward facing position and it should in theory give me a 360 degree value of the enemies current facing position in relation to the player.
Bascially you need to know which sprite ( group ) to show the player. So, which way is the BP facing with respect to the player?
The lower part is a vector between the player and the BP and the upper part finds the angle between that and the direction of the BP.
I should there are many ways of doing this, and I haven’t tested this
Come back if you get stuck…
I cant seem to find the angle between function, nothing is popping up on blueprints. Is it called something else in the search terms?
Pull a pin out from a vector and type ‘angle’…
I mean yeah duh, but all the selection given for angle weren’t ‘angle between’ and I even turned off context relevantive and the closest thing I got was was angle between relative 2D or something along those lines. Mind you this is a fully fledged 3D FPS game that I’m just slapping a paper sprite on already exist player capsules. Im not sure if there’s a specific plugin That I need or if I’m just blind and didn’t seen it in the hierarchy.
Must be your engine version, I’m on 23.
Then you have to do it with dot product, hold on.
,Just wanna follow up on this, I was able to get the angle between working and I’m getting different values to pop up depending on the NPCs orientation to the camera. Unfortunately I’m super busy with work and I don’t know when I’ll be able to fully implement. It looks promising right now and I’m truly thankful for your help.
You’re welcome