Walkable slope for pawn
So I'm making a 2d adventure game and since I ran into some problems with the character class I decided to use a pawn class and write my movement from scratch. I've been making good progress so far (jumps, ladders, gravity, ledgeclimbing..) but one thing that has me stumped is walking up- or downhill hah.
How I've gone about it now is do a linetrace down from the pawn and getting the normal of the surface it's walking on, but the closest I've gotten after that is getting it to kinda hop up the slope because it's moving up and away from the floor causing gravity to kick in repeatedly. it does not look very well.
I've been scratching my head for a couple of days on this would really appreciate some input or ideas on how to make a pawn move up/downhill. Remember, I'm also moving the character with Adding world offset and not movement input since I don't wanna use the character movement component (partly because I ran into some limitations but mostly because I wanna challenge myself and learn more basic stuff)
Thanks in advance!
asked Oct 15 '15 at 11:00 PM in Blueprint Scripting
So for anyone reading this who has the slightest bit of knowledge about vector math should be able to solve this problem fairly easily.
I used a box trace for my floorcheck, got the floorNormal and crossProducted that with the world Y-axis. I multiplied that vector with the float I got from dotproducting input and the crossproduct.
I fixed the snagging by only sweeping the movement along x axis and not the movement along z axis. :)
answered Oct 17 '15 at 02:55 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here