x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Walkable slope for pawn

Hi!

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!

Product Version: UE 4.9
Tags:
more ▼

asked Oct 15 '15 at 11:00 PM in Blueprint Scripting

avatar image

ZeoZen
29 9 7 10

avatar image alperenakyuz Oct 16 '15 at 08:38 AM

Is there a specia reason for using a "pawn" instead of a "character" blueprint class?

avatar image ZeoZen Oct 16 '15 at 11:55 AM

As far as I recall it had mostly to do with movement modes, especially switching to flying when I needed to give the player character upwards movement for ladders. I think there was some other reason too but I can't quite remember. :p Also, as I said it's a nice way to learn

avatar image ZeoZen Oct 17 '15 at 01:38 PM

So I have the code for figuring out the movement vector, tho it seems getting the sampling of the groundnormal is actually kinda tricky. The ways I've tried ends up causing the player to snag at certain points where it transitions from one normal to another, i.e. transition between flat surface to hill. I'll fiddle around with it and post my findings as an answer. or if someone has any input on how I should trace for the normal please feel free to help out:D

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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. :)

more ▼

answered Oct 17 '15 at 02:55 PM

avatar image

ZeoZen
29 9 7 10

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question