Announcement

Collapse
No announcement yet.

4.9 Transition Guide

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    4.9 Transition Guide

    Dear Community,

    It is that happy day once again!

    Yay for 4.9!

    This thread is a place where you can post your research / ask questions as you upgrade your code bases to 4.9.

    Feel free to post compile errors you've solved or 4.9 errors / issues that you have not yet figured out so we can all do this process together!



    Rama
    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

    #2
    All FHitResults Now Return The Distance From Start To ImpactPoint

    Dear Community,

    This is one of my accepted pull requests!

    All FHitResults now have a property Distance that gives you the non-squared actual distance from the trace start to the impact point!

    I saw that PhysX was always returning this info and submitted the code to Epic to expose this valuable information.

    ~~~

    You Can Improve Performance of Your Game Code Now

    You can refactor a lot of code that had to use distance squared checks and separate distance calculations to just use FHitResult:: Distance now!

    This will actually improve the performance of your game code!


    Code:
    /**
     * Structure containing information about one hit of a trace, such as point of impact and surface normal at that point.
     */
    USTRUCT(BlueprintType, meta=(HasNativeBreak="Engine.GameplayStatics.BreakHitResult"))
    struct ENGINE_API FHitResult
    {
    	GENERATED_USTRUCT_BODY()
    
    	/** The distance from the TraceStart to the ImpactPoint in world space. This value is 0 if there was an initial overlap (trace started inside another colliding object). */[/B]
    	UPROPERTY()
    	float Distance;
    Enjoy!

    Rama
    Last edited by Rama; 08-31-2015, 02:44 PM.
    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

    Comment


      #3
      Woohoo, lets get this 4.9 Upgrade Party going =)
      Abatron Development Thread
      www.abatrongame.com
      Steam Store

      Comment


        #4
        Converting FLinearColor to Color

        If you want to convert a FLinearColor to a FColor, you must now use

        Code:
        .ToFColor(true)
        Code:
        Color.h
        
        /** Quantizes the linear color and returns the result as a FColor with optional sRGB conversion and quality as goal. */
        	CORE_API FColor ToFColor(const bool bSRGB) const;
        
        private:
        	/**
        	 * Please use .ToFColor(true) on FLinearColor if you wish to convert from FLinearColor to FColor,
        	 * with proper sRGB conversion applied.
        	 *
        	 * Note: Do not implement or make public.  We don't want people needlessly and implicitly converting between
        	 * FLinearColor and FColor.  It's not a free conversion.
        	 */
        	explicit FColor(const FLinearColor& LinearColor);
        ~~~

        BodySetup Include

        To get the definition of UBodySetup you must now include

        Code:
        //Body Setup
        #include "PhysicsEngine/BodySetup.h"
        ~~~

        PhysX Engine

        PToU Conversions moved to PhysXPublic

        The PToU conversion got moved from PhysicsPublic.h to PhysXPublic.h

        ~~~

        BodySetup::TriMesh -> TriMeshes

        Trimesh is now an array in BodySetup!

        Code:
        #if WITH_PHYSX
        	/** Physics triangle mesh, created from cooked data in CreatePhysicsMeshes */
        	TArray<physx::PxTriangleMesh*> TriMeshes;
        #endif
        Last edited by Rama; 08-31-2015, 03:21 PM.
        100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

        UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

        Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

        Comment


          #5
          //GameMode Errors

          PreLogin & InitNewPlayer override errors.
          argument changed to "const TSharedPtr<const FUniqueNetId>& UniqueId"

          Just need to add the "const" to overridden function that includes FUniqueNetId.
          Last edited by Devero; 08-31-2015, 03:35 PM.
          Abatron Development Thread
          www.abatrongame.com
          Steam Store

          Comment


            #6
            --Spawning function Deprecated, UGameplayStatics::BeginSpawningActorFromClass

            Old: BeginSpawningActorFromClass()

            Replace with: BeginDeferredActorSpawnFromClass()
            Abatron Development Thread
            www.abatrongame.com
            Steam Store

            Comment


              #7
              Spawning Actors with Collision Override replaces bNoCollisionFail

              Dear Community,

              As of 4.9, in World.h, there is a new enumerator for handling collision of newly created actors:

              Code:
              /** Defines available strategies for handling the case where an actor is spawned in such a way that it penetrates blocking collision. */
              UENUM(BlueprintType)
              enum class ESpawnActorCollisionHandlingMethod : uint8
              {
              	/** Fall back to default settings. */
              	Undefined								UMETA(DisplayName = "Default"),
              	/** Actor will spawn in desired location, regardless of collisions. */
              	AlwaysSpawn								UMETA(DisplayName = "Always Spawn, Ignore Collisions"),
              	/** Actor will try to find a nearby non-colliding location (based on shape components), but will always spawn even if one cannot be found. */
              	AdjustIfPossibleButAlwaysSpawn			UMETA(DisplayName = "Try To Adjust Location, But Always Spawn"),
              	/** Actor will try to find a nearby non-colliding location (based on shape components), but will NOT spawn unless one is found. */
              	AdjustIfPossibleButDontSpawnIfColliding	UMETA(DisplayName = "Try To Adjust Location, Don't Spawn If Still Colliding"),
              	/** Actor will fail to spawn. */
              	DontSpawnIfColliding					UMETA(DisplayName = "Do Not Spawn"),
              };
              So this

              Code:
              SpawnInfo.bNoCollisionFail = true;
              becomes this

              Code:
              SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
              Enjoy!

              Rama
              Last edited by Rama; 08-31-2015, 03:13 PM.
              100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

              UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

              Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

              Comment


                #8
                Thanks!
                Getting projects ready for the transition

                Comment


                  #9
                  Originally posted by Devero View Post
                  //GameMode Errors

                  PreLogin & InitNewPlayer override errors.
                  argument changed to "const TSharedPtr<const FUniqueNetId>& UniqueId"

                  Just need to add the "const" to overridden function that includes FUniqueNetId.
                  Ditto on RegisterPlayer override (GameSession function).
                  Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

                  Comment


                    #10
                    Originally posted by Rama View Post
                    Dear Community,

                    This is one of my accepted pull requests!

                    All FHitResults now have a property Distance that gives you the non-squared actual distance from the trace start to the impact point!

                    I saw that PhysX was always returning this info and submitted the code to Epic to expose this valuable information.

                    ~~~

                    You Can Improve Performance of Your Game Code Now

                    You can refactor a lot of code that had to use distance squared checks and separate distance calculations to just use FHitResult:: Distance now!

                    This will actually improve the performance of your game code!


                    Code:
                    /**
                     * Structure containing information about one hit of a trace, such as point of impact and surface normal at that point.
                     */
                    USTRUCT(BlueprintType, meta=(HasNativeBreak="Engine.GameplayStatics.BreakHitResult"))
                    struct ENGINE_API FHitResult
                    {
                    	GENERATED_USTRUCT_BODY()
                    
                    	/** The distance from the TraceStart to the ImpactPoint in world space. This value is 0 if there was an initial overlap (trace started inside another colliding object). */[/B]
                    	UPROPERTY()
                    	float Distance;
                    Enjoy!

                    Rama
                    Hey Rama,

                    Do you mind extending your tutorial ( https://wiki.unrealengine.com/Trace_Functions ) including this change? I'm confused how to apply it.

                    Thanks in advance!

                    Comment


                      #11
                      Originally posted by Zoc View Post
                      Hey Rama,

                      Do you mind extending your tutorial ( https://wiki.unrealengine.com/Trace_Functions ) including this change? I'm confused how to apply it.

                      Thanks in advance!
                      Okay I've now updated my Traces wiki to 4.9.0 !

                      I include examples of how to use the new FHitResult Distance property that was my pull request to Epic.

                      Trace Functions in UE4
                      https://wiki.unrealengine.com/Trace_Functions

                      Using Distance Property of FHitResult
                      https://wiki.unrealengine.com/Trace_...Exact_Distance

                      Enjoy!

                      Rama
                      100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                      UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                      Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                      Comment


                        #12
                        What does this mean?

                        "New: AIController class now derives from IGenericTeamAgentInterface which will make team-handling easier in the near future."
                        "If your game-specific AI controller class already derives from IGenericTeamAgentInterface, you probably should remove it from your controller's parent classes".

                        So confusing... what specifically do I need to remove? Do I suppose to unassigned my AIControllerClass from my controller? What the heck?

                        I'm also getting engine's compile error:

                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(62): error C2059: syntax error : 'constant'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(62): error C2238: unexpected token(s) preceding ';'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(79): error C2589: 'constant' : illegal token on right side of '::'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(79): error C2059: syntax error : '::'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(62): error C2059: syntax error : 'constant'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(62): error C2238: unexpected token(s) preceding ';'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(79): error C2589: 'constant' : illegal token on right side of '::'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(79): error C2059: syntax error : '::'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(62): error C2059: syntax error : 'constant'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(62): error C2238: unexpected token(s) preceding ';'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(79): error C2589: 'constant' : illegal token on right side of '::'
                        1>c:\program files\unreal engine\4.9\engine\source\runtime\aimodule\classes\GenericTeamAgentInterface.h(79): error C2059: syntax error : '::'
                        Does this have to do with it?
                        Last edited by KillerPenguin; 09-03-2015, 03:49 AM.

                        Comment


                          #13
                          Sorry, my fault. I had [#define NoTeam] somewhere in my code and it conflicted with the UE4.9's GenericTeamAgentInterface.

                          Took hours to dig through to find it though. :/

                          ps. Another question, PostProcess's Settings.Blendables is now depreciated and cannot be accessed. So how do I clear all its array? Using Settings.SetBaseValues() seems to remove everything, not just the blendables array.
                          Last edited by KillerPenguin; 09-03-2015, 10:15 PM.

                          Comment


                            #14
                            To declare a USoundCue pointer like this:

                            USoundCue* Sound1;
                            you will need to add the #include "Engine.h"

                            Comment


                              #15
                              The removed "EnableParent" in the tick function.
                              Instead of it, you should enable/disable the tick in each component.

                              Comment

                              Working...
                              X