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"

[Closed] Adjust gravity via custom WorldSettings class

Hi, I'm trying to change the gravity with worldsettings. I have a custom worldsettings class with a few lines inside (below). I can't manage to call globalGravityZ = 100; or worldGravityZ = 100;

I know it;s probably AWorldSettings:: or something different but I don't know exactly.

.h

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "CoreMinimal.h"
 #include "GameFramework/WorldSettings.h"
 #include "HBGWorldSettings.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class HGB_API AHBGWorldSettings : public AWorldSettings
 {
     GENERATED_BODY()
         UFUNCTION(BlueprintCallable, Category = "HYBRIDGOLF|WorldSettings")
         static void ChangeGravity(int Grav);
         //AWorldSettings* MyWorldSetting = GetWorldSettings();
 
 };


My .cpp is basically lines of tetsing (I'm new to unrealscript (if thats what it's still called ahah) I came from Unity and pretty adapted to their way of things..

Anyways I found these IntelliSense fillers (in pic), can anyone help me utilize it? I basically want to be able to call a function from blueprint to tell the world settings gravity to be a certain value.

alt text

The int GRAVITY = is just a line i was testing to make sure it compiled.

Thanks for any help.

Tim.

Product Version: UE 4.19
Tags:
capture.png (48.9 kB)
more ▼

asked Oct 28 '18 at 02:59 PM in C++ Programming

avatar image

timsev7n
98 2 5 8

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

The question has been closed Oct 28 '18 at 11:39 PM by timsev7n for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

alt textNevermind, I will just explicitly set it through AddForce. It's working great plus I have the ability to use overlap events etc to set the gravity to a certain number in certain areas on the map on certain actors, certain direction etc... Much easier and versatile!

EDIT: Added a pic for reference. The grounded bool is just begin and end overlap events setting grounded to true/false.

capture.png (99.0 kB)
more ▼

answered Oct 28 '18 at 11:39 PM

avatar image

timsev7n
98 2 5 8

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

Follow this question

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

Answers to this question