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"

How can I create a gravity effect from scratch?

I have a custom pawn I created myself. I made a movement component, and now want to add gravity. If I do AddVector(FVector(0.f, 0.f, -1.f) * GravityPower) in the movement component's tick, where GravityPower = 10, the character barely jumps and falls down normally from a ledge. If I do GravityPower = 0.3, the character jumps a bit higher, and falls down very slowly How can I actually add gravity to my pawn without resorting to deriving from ACharacter?

Product Version: UE 4.19
more ▼

asked Jul 17 '18 at 04:42 PM in C++ Programming

avatar image

Pencil Amazing
13 3 4 7

avatar image mightyenigma Jul 17 '18 at 05:58 PM

how does your Jump work?

avatar image Pencil Amazing Jul 18 '18 at 03:41 PM

I just do AddMovementInput(GetActorUpVector(), JumpPower)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Rather than attempting to perform physics calculations yourself, you could set your custom pawn to simulate physics (it's a checkbox in the details panel) and then lock certain rotations to prevent it from spiraling in unrealistic ways.

more ▼

answered Jul 17 '18 at 06:28 PM

DarkwindRichard (suspended)
avatar image Pencil Amazing Jul 18 '18 at 03:43 PM

This actually fixed my problems. Can you make this an answer so I can accept it?

avatar image DarkwindRichard Jul 18 '18 at 04:18 PM

Surely! I'll also change the wording as I had assumed you were attempting to do custom physics for a reason.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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