r.PhysicsField.SingleTarget
r.PhysicsField.SingleTarget
#Overview
name: r.PhysicsField.SingleTarget
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Limnit the physics field build to only one target, the linear force
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PhysicsField.SingleTarget
is to limit the physics field build to only one target, specifically the linear force. This setting variable is part of Unreal Engine’s physics system, particularly the physics field component.
This setting variable is primarily used in the physics field subsystem of Unreal Engine. It is referenced in the PhysicsFieldComponent.cpp file, which is part of the Engine module.
The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be changed at runtime using console commands or through configuration files.
The associated variable GPhysicsFieldSingleTarget
directly interacts with r.PhysicsField.SingleTarget
. They share the same value, with GPhysicsFieldSingleTarget
being the actual integer variable used in the C++ code.
Developers must be aware that when this variable is set to 1, it limits the physics field to only build for the linear force target. This can have significant implications on the behavior of physics fields in the game or application.
Best practices when using this variable include:
- Use it for optimization purposes when you only need linear force in your physics fields.
- Be cautious when enabling it, as it will ignore other physics field targets.
- Test thoroughly when changing this setting, as it can significantly alter physics behavior.
Regarding the associated variable GPhysicsFieldSingleTarget
:
The purpose of GPhysicsFieldSingleTarget
is to serve as the actual integer variable that stores the value set by r.PhysicsField.SingleTarget
.
It’s used in the Engine module, specifically in the physics field component implementation.
The value is set through the console variable system, initialized to 0, and can be changed at runtime.
It directly interacts with r.PhysicsField.SingleTarget
, essentially being the C++ representation of the console variable.
Developers should be aware that this variable is used in conditional statements to determine whether to limit the physics field to a single target (linear force) or not.
Best practices include:
- Avoid directly modifying this variable in code; instead, use the console variable system to change its value.
- When reading this variable’s value in code, be aware that it can change at runtime.
- Consider the performance implications when this variable is set to 1, as it may affect physics calculations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:92
Scope: file
Source code excerpt:
int32 GPhysicsFieldSingleTarget = 0;
FAutoConsoleVariableRef CVarPhysicsFieldSingleTarget(
TEXT("r.PhysicsField.SingleTarget"),
GPhysicsFieldSingleTarget,
TEXT("Limnit the physics field build to only one target, the linear force"),
ECVF_RenderThreadSafe
);
/** Spatial culling */
#Associated Variable and Callsites
This variable is associated with another variable named GPhysicsFieldSingleTarget
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:90
Scope: file
Source code excerpt:
/** Single Target Limit */
int32 GPhysicsFieldSingleTarget = 0;
FAutoConsoleVariableRef CVarPhysicsFieldSingleTarget(
TEXT("r.PhysicsField.SingleTarget"),
GPhysicsFieldSingleTarget,
TEXT("Limnit the physics field build to only one target, the linear force"),
ECVF_RenderThreadSafe
);
/** Spatial culling */
int32 GPhysicsFieldEnableCulling = 1;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:912
Scope (from outer to inner):
file
function void UPhysicsFieldComponent::OnRegister
Source code excerpt:
LocalInstance = new FPhysicsFieldInstance();
if (GPhysicsFieldSingleTarget == 1)
{
TArray<EFieldPhysicsType> TargetTypes = { EFieldPhysicsType::Field_LinearForce };
LocalInstance->InitInstance(TargetTypes, bBuildClipmaps[FieldIndex]);
}
else
{