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 do I dynamically change the z axis gravity in blueprint?

I'm trying to have it so the player walks over a trigger and their gravity is reversed to positive z instead of the default negative z. The player would then be able to walk on the ceiling as he would normally be able to walk on the ground. I also want to have a volume on the ceiling that will flip the gravity back to the negative z so the player falls back to the floor. I want to accomplish this through blueprint.

I've seen a lot of conflicting information about this on the forums where some people seem to indicate you can do this (but don't specify how) and others saying it is impossible at this time. I'm wondering if anyone knows if this is possible to do in blueprint and if so, how I might accomplish it. Some people have mentioned changing the gravity scale on the character's character movement component but I don't know how you access that in the event track of the blueprint to set it.

Here is what I've been able to do so far which I realize is super hacky and not a good solution as it doesn't fully work anyway (I haven't put in the flip camera/player yet):

alt text

This will at least allow me to walk on an object then applies a velocity to the player until it hits a trigger on the ceiling which then changes the bool to apply a 0,0,0 velocity thus stopping the player. The problem is at that point, the player can't move or do anything. I've tried applying at force (0,0, 9.8) at this point, but it also doesn't seem to do anything.

I feel like there should be a really easy solution to this that I'm missing. A Set Gravity Z node would be great (especially since there is a Get Gravity Z node). However, I just haven't found anything like this.

If anyone can provide an answer as to whether this is possible and if so, how I can do it, it is appreciated.

Product Version: Not Selected
gravityflip.png (204.8 kB)
more ▼

asked Jul 30 '14 at 12:25 AM in Blueprint Scripting

avatar image

16 3 4 5

avatar image Polivantage Jan 24 '16 at 12:19 PM

I think that alternatively, you (probably) could manually script the entire behaviour of walking upside down, including making the character stick to the chosen surface, jump with a different trajectory, etc.. all in blueprints. So you'd have to rotate the character, and change every input that you normally use for something different, not always just a reverse. This would be a really long, inefficient approach, yet it would also give you huge control of how you want the movement to be, but if anyone knows a better, simpler way, I'd love to know, because I'm trying to achieve a similar effect.. EDIT: Have you tried flipping the camera and the level geometry upside down, lol? might work

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

1 answer: sort voted first

I cant help you as much I would like it, Im trying to do something similar, and I want my character to being able to walk on the roof.. ..but until now I have only being able to invert gravity scale: alt text

Sorry it is on spanish, but it is quite simple, I just take the actual Gravity Scale and multiply it by -1, every time.. ..about walking on the top, I think it cant be done un least you override the original physics code.. ..I think you could put a collision box on the foots of your character that way if it hits the ceilling it can stops.. ..I may do that as well u_u ..but I'll try to find out how to override the C++ code, let you know if I find something

more ▼

answered Aug 21 '15 at 02:42 AM

avatar image

36 2 3 7

(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