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!**
```
/**
* 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). */**
UPROPERTY()
float Distance;
```
Enjoy!
Rama
If you want to convert a FLinearColor to a FColor, you must now use
.ToFColor(true)
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
```
//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!
```
#if WITH_PHYSX
/** Physics triangle mesh, created from cooked data in CreatePhysicsMeshes */
TArray<physx::PxTriangleMesh*> TriMeshes;
#endif
```
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:
/** 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"),
};
“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?
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.
//FPostProcessSettings Struct
/**
* Allows custom post process materials to be defined, using a MaterialInstance with the same Material as its parent to allow blending.
* For materials this needs to be the "PostProcess" domain type. This can be used for any UObject object implementing the IBlendableInterface (e.g. could be used to fade weather settings).
*/
UPROPERTY(EditAnywhere, Category="PostProcessSettings", meta=( Keywords="PostProcess", DisplayName = "Blendables" ))
FWeightedBlendables **WeightedBlendables**;
// for backwards compatibility
UPROPERTY()
TArray<UObject*> **Blendables_DEPRECATED**;
So you’ll simply be clearing the WeightedBlendables array instead!
Where does const get added to the line? i.e. what should this line read?
virtual void PreLogin(const FString& Options, const FString& Address, const TSharedPtr<class FUniqueNetId>& UniqueId, FString& ErrorMessage) override;