public void LoadFromCurrentSettings() { gravity = Physics.gravity; physicsTimeStep = Time.fixedDeltaTime; autoSimulation = Physics.autoSimulation; autoSyncTransforms = Physics.autoSyncTransforms; #if UNITY_EDITOR // Unsupported settings, can only be changed in editor var obj = UnityEditor.Unsupported.GetSerializedAssetInterfaceSingleton("PhysicsManager"); UnityEditor.SerializedObject so = new UnityEditor.SerializedObject(obj); defaultMaterial = so.FindProperty("m_DefaultMaterial").objectReferenceValue as PhysicMaterial; enhancedDeterminism = so.FindProperty("m_EnableEnhancedDeterminism").boolValue; enableAdaptiveForce = so.FindProperty("m_EnableAdaptiveForce").boolValue; unifiedHeightmaps = so.FindProperty("m_EnableUnifiedHeightmaps").boolValue; frictionType = (FrictionType)so.FindProperty("m_FrictionType").intValue; worldBounds = so.FindProperty("m_WorldBounds").boundsValue; worldSubdivisions = so.FindProperty("m_WorldSubdivisions").intValue; #endif sleepThreashold = Physics.sleepThreshold; bounceThreshold = Physics.bounceThreshold; defaultContactOffset = Physics.defaultContactOffset; defaultSolverIterations = Physics.defaultSolverIterations; defaultSolverVelocityIterations = Physics.defaultSolverVelocityIterations; clothInterCollisionDistance = Physics.interCollisionDistance; clothInterCollisionSettingsToggle = Physics.interCollisionSettingsToggle; clothInterCollisionStiffness = Physics.interCollisionStiffness; queriesHitBackfaces = Physics.queriesHitBackfaces; queriesHitTriggers = Physics.queriesHitTriggers; }
public void ApplyUnsupportedSettings(PhysicMaterial defaultMaterial, bool enhancedDeterminism, bool adaptiveForce, bool unifiedHeightmaps, FrictionType frictionType) { #if UNITY_EDITOR var obj = UnityEditor.Unsupported.GetSerializedAssetInterfaceSingleton("PhysicsManager"); UnityEditor.SerializedObject so = new UnityEditor.SerializedObject(obj); so.FindProperty("m_DefaultMaterial").objectReferenceValue = this.defaultMaterial = defaultMaterial; so.FindProperty("m_EnableEnhancedDeterminism").boolValue = this.enhancedDeterminism = enhancedDeterminism; so.FindProperty("m_EnableAdaptiveForce").boolValue = this.enableAdaptiveForce = adaptiveForce; so.FindProperty("m_EnableUnifiedHeightmaps").boolValue = this.unifiedHeightmaps = unifiedHeightmaps; so.FindProperty("m_FrictionType").intValue = (int)(this.frictionType = frictionType); so.ApplyModifiedProperties(); #endif }
internal FrictionPointDefinitionBlockBase(BinaryReader binaryReader) { this.markerName = binaryReader.ReadStringID(); this.flags = (Flags)binaryReader.ReadInt32(); this.fractionOfTotalMass = binaryReader.ReadSingle(); this.radius = binaryReader.ReadSingle(); this.damagedRadius = binaryReader.ReadSingle(); this.frictionType = (FrictionType)binaryReader.ReadInt16(); this.invalidName_ = binaryReader.ReadBytes(2); this.movingFrictionVelocityDiff = binaryReader.ReadSingle(); this.eBrakeMovingFriction = binaryReader.ReadSingle(); this.eBrakeFriction = binaryReader.ReadSingle(); this.eBrakeMovingFrictionVelDiff = binaryReader.ReadSingle(); this.invalidName_0 = binaryReader.ReadBytes(20); this.collisionGlobalMaterialName = binaryReader.ReadStringID(); this.invalidName_1 = binaryReader.ReadBytes(2); this.modelStateDestroyed = (ModelStateDestroyedOnlyNeedPointCanDestroyFlagSet)binaryReader.ReadInt16(); this.regionName = binaryReader.ReadStringID(); this.invalidName_2 = binaryReader.ReadBytes(4); }
public EnvironmentData(InclineType incline, FrictionType friction) : this(friction) { inclineType = incline; switch (inclineType) { case InclineType.ThreeTileLeft1: case InclineType.ThreeTileLeft2: case InclineType.ThreeTileLeft3: case InclineType.TwoTileLeft1: case InclineType.TwoTileLeft2: inclineRight = false; break; case InclineType.ThreeTileRight1: case InclineType.ThreeTileRight2: case InclineType.ThreeTileRight3: case InclineType.TwoTileRight1: case InclineType.TwoTileRight2: inclineRight = true; break; } }
private FrictionSettings GetFrictionSettingsForState(Wheel wheel, WheelState state, FrictionType frictionType) { if (wheel.info.isFrontWheel) { switch (state) { case WheelState.powerslide: return(frictionType == FrictionType.forward ? _physicsSettings.frontPowerslideForwardFriction : _physicsSettings.frontPowerslideSidewaysFriction); default: return(frictionType == FrictionType.forward ? _physicsSettings.frontDefaultForwardFriction : _physicsSettings.frontDefaultSidewaysFriction); } } else { switch (state) { case WheelState.powerslide: return(frictionType == FrictionType.forward ? _physicsSettings.rearPowerslideForwardFriction : _physicsSettings.rearPowerslideSidewaysFriction); default: return(frictionType == FrictionType.forward ? _physicsSettings.rearDefaultForwardFriction : _physicsSettings.rearDefaultSidewaysFriction); } } throw new ArgumentOutOfRangeException($@"No friction settings found for wheel: {wheel.info.isFrontWheel}, state: {state}, frictionType: {frictionType}"); }
public EnvironmentData(FrictionType type) : this(true) { this.frictionType = type; }