Photon Fusion 2.1.1

PhysicsSettings Struct Reference

Physics settings. More...

Public Member Functions

 PhysicsSettings ()
 Physics settings.

Public Attributes

float AngularVelCorrectionMul = 1f
 Coefficient used when extrapolating the angular velocity. Higher values will result in a bigger extrapolated velocity. See LinearVelCorrectionMul.
float Damper = 2f
 The resistance of the correction oscillation, increase this value to increase the resistance of the spring correction and control overshooting. Keep it bellow the Spring value.
bool DebugPhysics = false
 Draw physics debug gizmos.
PhysicsCorrection ErrorCorrectionType = PhysicsCorrection.Velocity
 Correction type to be applied on the physics body. [Velocity] is recommended.
bool ForecastEnabled = true
 Per object option to control Forecast Physics. Only effective when Forecast Physics is enabled by NetworkProjectConfig.PhysicsForecast.
GravityForecast GravityForecast = GravityForecast.Auto
 Whether we apply gravity to the forecast.
float HighErrorSimilarityThreshold = 1f
 If current error direction and magnitude dot previous error direction and magnitude is above this accrue time towards a reset. This value roughly represents how little the direction of the linear error has changed, and how big the error is. Roughly metres squared.
float ImpactCorrectionTimeComplete = 0.3f
 After ImpactStartCorrectionTime we lerp from no correction to normal correction at this time.
float ImpactStartCorrectionTime = 0.1f
 How long after an impact (OnCollisionEnter called) do we apply a correction. Between the impact and this time no local correction is applied.
float LinearVelCorrectionMul = 1f
 A scale factor applied to the correction velocity if [Velocity] or [PositionRotation] is the [Error Correction Type]. Higher values means the body will be corrected faster, but can increase overshoot.
float LowCorrectionProgressThreshold = .015f
 If correction progress is below this accrue time towards a reset, in metres.
float MaxAngularError = 0
 Angular error above this threshold will force a immediate move to the remote physics state. Zero means no limit.
float MaxErrorTotalTime = .5f
 The maximum amount of time in seconds that the physics body is allowed to accrue errors that are not considered to be corrected before performing an immediate move to the remote physics state.
float MaxExtrapolationTime = .15f
 Maximum extrapolation time clients are allowed to do. Higher values means extrapolating more.
float MaxLinearError = 0
 Linear error above this threshold will force an immediate move to the remote physics state. Zero means no limit.
float MaxRemoteSleepIgnoreTime = 0.5f
 The maximum amount of time in seconds that the physics body will ignore remote state informing that the body should be sleeping. Higher values give local physics more time to try to reach the sleeping state before an immediate move is required.
float MinAngularDetectedError = 3
 Error must be over this value (degrees) for correction to be applied. Errors below this threshold are not considered.
float MinImpactfulCollisionAlignment = 0.3f
 Minimum collision alignment required to trigger local physics simulation. 0 represents a collision movement parallel to the surface (glancing) 1 represents a collision movement perpendicular to the surface (head-on).
float MinLinearDetectedError = .02f
 Error must be over this value (metres) for correction to be applied. Errors below this threshold are not considered.
float PositionCorrectionLerp = .15f
 Lerp object position from local to extrapolated (Range 0..1). Only used if the Error Correction Type is [Position Rotation]. Applied in FixedUpdate().
float RotationCorrectionLerp = .15f
 Lerp object rotation from local to extrapolated (Range 0..1) Applied in FixedUpdate().
bool SetForecastDisabledProxyRigidbodiesToKinematic = true
 When true, the rigidbody will be set to kinematic for proxy objects when Forecast Physics is disabled. This lets a Host or Dedicated server run physics which are in remote time and 'view only' from the point of view of clients. Setting this to false is for compatibility with Fusion 2.0 behaviour and is otherwise not recommended.
bool SetPhysicsInterpolationToDisabledWhenKinematic = true
 When true, physics interpolation will be disabled for the Rigidbody on Forecast Physics objects which are set to kinematic. The original state is restored when kinematic is disabled. This prevents the physics interpolation interfering with object motion. Set to false to handle this explicitly in game code and have Fusion not change the physics interpolation settings.
float Spring = 75f
 The intensity of the error correction, increase this value to make the error be corrected faster. If overshooting try increasing Damper.

Detailed Description

Physics settings.

Member Data Documentation

◆ MinImpactfulCollisionAlignment

float MinImpactfulCollisionAlignment = 0.3f

Minimum collision alignment required to trigger local physics simulation. 0 represents a collision movement parallel to the surface (glancing) 1 represents a collision movement perpendicular to the surface (head-on).

Setting a value of 0 will treat all collisions as impactful

This value is cos(theta) where theta is the angle between the objects velocity and the collisions normal.

When a collision is detected above this threshold the impact correction timer starts ImpactStartCorrectionTime and ImpactCorrectionTimeComplete for further details