mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-13 06:59:46 +07:00
physics settings in IsoWorld!
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
###### Version 3.0.2
|
||||
|
||||
* Physics settings in IsoWorld inspector
|
||||
|
||||
###### Version 3.0.1
|
||||
|
||||
* Fix serialization generic classes problem
|
||||
|
||||
@@ -1163,6 +1163,12 @@ MonoBehaviour:
|
||||
_tileHeight: 0.65
|
||||
_stepDepth: 0.1
|
||||
_startDepth: 1
|
||||
_gravity: {x: 0, y: 0, z: -9.81}
|
||||
_contactOffset: 0.01
|
||||
_sleepThreshold: 0.005
|
||||
_bounceThreshold: 2
|
||||
_solverIterations: 6
|
||||
_solverVelocityIterations: 1
|
||||
_showIsoBounds: 0
|
||||
_showScreenBounds: 0
|
||||
_snapByCells: 1
|
||||
@@ -3518,7 +3524,7 @@ Prefab:
|
||||
objectReference: {fileID: 1768303659}
|
||||
- target: {fileID: 11477906, guid: f34dc3b1e71a94249ad50db729f01df0, type: 2}
|
||||
propertyPath: PrevSceneName
|
||||
value: Scene10
|
||||
value: Scene09
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11477906, guid: f34dc3b1e71a94249ad50db729f01df0, type: 2}
|
||||
propertyPath: NextSceneName
|
||||
|
||||
@@ -258,7 +258,7 @@ Prefab:
|
||||
objectReference: {fileID: 1396455883}
|
||||
- target: {fileID: 11477906, guid: f34dc3b1e71a94249ad50db729f01df0, type: 2}
|
||||
propertyPath: NextSceneName
|
||||
value: Scene10
|
||||
value: Scene00
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11477906, guid: f34dc3b1e71a94249ad50db729f01df0, type: 2}
|
||||
propertyPath: PrevSceneName
|
||||
@@ -877,6 +877,12 @@ MonoBehaviour:
|
||||
_tileHeight: 1.6
|
||||
_stepDepth: 0.1
|
||||
_startDepth: 1
|
||||
_gravity: {x: 0, y: 0, z: -9.81}
|
||||
_contactOffset: 0.01
|
||||
_sleepThreshold: 0.005
|
||||
_bounceThreshold: 2
|
||||
_solverIterations: 6
|
||||
_solverVelocityIterations: 1
|
||||
_showIsoBounds: 0
|
||||
_showScreenBounds: 0
|
||||
_snapByCells: 1
|
||||
@@ -1504,6 +1510,12 @@ MonoBehaviour:
|
||||
_tileHeight: 0.8
|
||||
_stepDepth: 0.1
|
||||
_startDepth: 1
|
||||
_gravity: {x: 0, y: 0, z: -9.81}
|
||||
_contactOffset: 0.01
|
||||
_sleepThreshold: 0.005
|
||||
_bounceThreshold: 2
|
||||
_solverIterations: 6
|
||||
_solverVelocityIterations: 1
|
||||
_showIsoBounds: 0
|
||||
_showScreenBounds: 0
|
||||
_snapByCells: 1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ec41ef5e50ed43d3a9e588114ce3b90
|
||||
timeCreated: 1477147799
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,33 +17,57 @@ namespace IsoTools {
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public const float DefTileSize = 32.0f;
|
||||
public const float MinTileSize = float.Epsilon;
|
||||
public const float MaxTileSize = float.MaxValue;
|
||||
public const float DefTileSize = 32.0f;
|
||||
public const float MinTileSize = float.Epsilon;
|
||||
public const float MaxTileSize = float.MaxValue;
|
||||
|
||||
public const float DefTileRatio = 0.5f;
|
||||
public const float MinTileRatio = 0.25f;
|
||||
public const float MaxTileRatio = 1.0f;
|
||||
public const float DefTileRatio = 0.5f;
|
||||
public const float MinTileRatio = 0.25f;
|
||||
public const float MaxTileRatio = 1.0f;
|
||||
|
||||
public const float DefTileAngle = 45.0f;
|
||||
public const float MinTileAngle = 0.0f;
|
||||
public const float MaxTileAngle = 90.0f;
|
||||
public const float DefTileAngle = 45.0f;
|
||||
public const float MinTileAngle = 0.0f;
|
||||
public const float MaxTileAngle = 90.0f;
|
||||
|
||||
public const float DefTileHeight = DefTileSize;
|
||||
public const float MinTileHeight = MinTileSize;
|
||||
public const float MaxTileHeight = MaxTileSize;
|
||||
public const float DefTileHeight = DefTileSize;
|
||||
public const float MinTileHeight = MinTileSize;
|
||||
public const float MaxTileHeight = MaxTileSize;
|
||||
|
||||
public const float DefStepDepth = 0.1f;
|
||||
public const float MinStepDepth = float.Epsilon;
|
||||
public const float MaxStepDepth = float.MaxValue;
|
||||
public const float DefStepDepth = 0.1f;
|
||||
public const float MinStepDepth = float.Epsilon;
|
||||
public const float MaxStepDepth = float.MaxValue;
|
||||
|
||||
public const float DefStartDepth = 1.0f;
|
||||
public const float MinStartDepth = float.MinValue;
|
||||
public const float MaxStartDepth = float.MaxValue;
|
||||
public const float DefStartDepth = 1.0f;
|
||||
public const float MinStartDepth = float.MinValue;
|
||||
public const float MaxStartDepth = float.MaxValue;
|
||||
|
||||
public const float DefSnapDistance = 0.2f;
|
||||
public const float MinSnapDistance = 0.0f;
|
||||
public const float MaxSnapDistance = 0.5f;
|
||||
public const float DefGravityX = 0.0f;
|
||||
public const float DefGravityY = 0.0f;
|
||||
public const float DefGravityZ = -9.81f;
|
||||
|
||||
public const float DefContactOffset = 0.01f;
|
||||
public const float MinContactOffset = float.Epsilon;
|
||||
public const float MaxContactOffset = float.MaxValue;
|
||||
|
||||
public const int DefSolverIterations = 6;
|
||||
public const int MinSolverIterations = 1;
|
||||
public const int MaxSolverIterations = int.MaxValue;
|
||||
|
||||
public const int DefSolverVelocityIterations = 1;
|
||||
public const int MinSolverVelocityIterations = 1;
|
||||
public const int MaxSolverVelocityIterations = int.MaxValue;
|
||||
|
||||
public const float DefSleepThreshold = 0.005f;
|
||||
public const float MinSleepThreshold = float.MinValue;
|
||||
public const float MaxSleepThreshold = float.MaxValue;
|
||||
|
||||
public const float DefBounceThreshold = 2.0f;
|
||||
public const float MinBounceThreshold = float.MinValue;
|
||||
public const float MaxBounceThreshold = float.MaxValue;
|
||||
|
||||
public const float DefSnapDistance = 0.2f;
|
||||
public const float MinSnapDistance = 0.0f;
|
||||
public const float MaxSnapDistance = 0.5f;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
@@ -112,6 +136,73 @@ namespace IsoTools {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Physics properties
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
[Header("Physics Settings")]
|
||||
[SerializeField]
|
||||
Vector3 _gravity = new Vector3(DefGravityX, DefGravityY, DefGravityZ);
|
||||
public Vector3 gravity {
|
||||
get { return _gravity; }
|
||||
set {
|
||||
_gravity = value;
|
||||
ChangePhysicsProperty();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
float _contactOffset = DefContactOffset;
|
||||
public float contactOffset {
|
||||
get { return _contactOffset; }
|
||||
set {
|
||||
_contactOffset = Mathf.Clamp(value, MinContactOffset, MaxContactOffset);
|
||||
ChangePhysicsProperty();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
float _sleepThreshold = DefSleepThreshold;
|
||||
public float sleepThreshold {
|
||||
get { return _sleepThreshold; }
|
||||
set {
|
||||
_sleepThreshold = Mathf.Clamp(value, MinSleepThreshold, MaxSleepThreshold);
|
||||
ChangePhysicsProperty();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
float _bounceThreshold = DefBounceThreshold;
|
||||
public float bounceThreshold {
|
||||
get { return _bounceThreshold; }
|
||||
set {
|
||||
_bounceThreshold = Mathf.Clamp(value, MinBounceThreshold, MaxBounceThreshold);
|
||||
ChangePhysicsProperty();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
int _solverIterations = DefSolverIterations;
|
||||
public int solverIterations {
|
||||
get { return _solverIterations; }
|
||||
set {
|
||||
_solverIterations = Mathf.Clamp(value, MinSolverIterations, MaxSolverIterations);
|
||||
ChangePhysicsProperty();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
int _solverVelocityIterations = DefSolverVelocityIterations;
|
||||
public int solverVelocityIterations {
|
||||
get { return _solverVelocityIterations; }
|
||||
set {
|
||||
_solverVelocityIterations = Mathf.Clamp(value, MinSolverVelocityIterations, MaxSolverVelocityIterations);
|
||||
ChangePhysicsProperty();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Instances
|
||||
@@ -382,6 +473,15 @@ namespace IsoTools {
|
||||
Internal_SetDirtyInEditorMode();
|
||||
}
|
||||
|
||||
void ChangePhysicsProperty() {
|
||||
UnityEngine.Physics.gravity = gravity;
|
||||
UnityEngine.Physics.defaultContactOffset = contactOffset;
|
||||
UnityEngine.Physics.sleepThreshold = sleepThreshold;
|
||||
UnityEngine.Physics.bounceThreshold = bounceThreshold;
|
||||
UnityEngine.Physics.defaultSolverIterations = solverIterations;
|
||||
UnityEngine.Physics.defaultSolverVelocityIterations = solverVelocityIterations;
|
||||
}
|
||||
|
||||
void StepSortingProcess() {
|
||||
_screenSolver.StepSortingAction(this);
|
||||
if ( _sortingSolver.StepSortingAction(this, _screenSolver) ) {
|
||||
@@ -398,6 +498,7 @@ namespace IsoTools {
|
||||
|
||||
void Start() {
|
||||
ChangeSortingProperty();
|
||||
ChangePhysicsProperty();
|
||||
StepSortingProcess();
|
||||
}
|
||||
|
||||
@@ -436,39 +537,53 @@ namespace IsoTools {
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void Reset() {
|
||||
tileSize = DefTileSize;
|
||||
tileRatio = DefTileRatio;
|
||||
tileAngle = DefTileAngle;
|
||||
tileHeight = DefTileHeight;
|
||||
stepDepth = DefStepDepth;
|
||||
startDepth = DefStartDepth;
|
||||
tileSize = DefTileSize;
|
||||
tileRatio = DefTileRatio;
|
||||
tileAngle = DefTileAngle;
|
||||
tileHeight = DefTileHeight;
|
||||
stepDepth = DefStepDepth;
|
||||
startDepth = DefStartDepth;
|
||||
|
||||
isShowIsoBounds = false;
|
||||
isShowScreenBounds = false;
|
||||
isSnapByCells = true;
|
||||
isSnapByObjects = true;
|
||||
isSortInSceneView = true;
|
||||
snappingDistance = DefSnapDistance;
|
||||
isShowDepends = false;
|
||||
isShowQuadTree = false;
|
||||
gravity = new Vector3(DefGravityX, DefGravityY, DefGravityZ);
|
||||
contactOffset = DefContactOffset;
|
||||
sleepThreshold = DefSleepThreshold;
|
||||
bounceThreshold = DefBounceThreshold;
|
||||
solverIterations = DefSolverIterations;
|
||||
solverVelocityIterations = DefSolverVelocityIterations;
|
||||
|
||||
isShowIsoBounds = false;
|
||||
isShowScreenBounds = false;
|
||||
isSnapByCells = true;
|
||||
isSnapByObjects = true;
|
||||
isSortInSceneView = true;
|
||||
snappingDistance = DefSnapDistance;
|
||||
isShowDepends = false;
|
||||
isShowQuadTree = false;
|
||||
}
|
||||
|
||||
void OnValidate() {
|
||||
tileSize = _tileSize;
|
||||
tileRatio = _tileRatio;
|
||||
tileAngle = _tileAngle;
|
||||
tileHeight = _tileHeight;
|
||||
stepDepth = _stepDepth;
|
||||
startDepth = _startDepth;
|
||||
tileSize = _tileSize;
|
||||
tileRatio = _tileRatio;
|
||||
tileAngle = _tileAngle;
|
||||
tileHeight = _tileHeight;
|
||||
stepDepth = _stepDepth;
|
||||
startDepth = _startDepth;
|
||||
|
||||
isShowIsoBounds = _showIsoBounds;
|
||||
isShowScreenBounds = _showScreenBounds;
|
||||
isSnapByCells = _snapByCells;
|
||||
isSnapByObjects = _snapByObjects;
|
||||
isSortInSceneView = _sortInSceneView;
|
||||
snappingDistance = _snappingDistance;
|
||||
isShowDepends = _showDepends;
|
||||
isShowQuadTree = _showQuadTree;
|
||||
gravity = _gravity;
|
||||
contactOffset = _contactOffset;
|
||||
sleepThreshold = _sleepThreshold;
|
||||
bounceThreshold = _bounceThreshold;
|
||||
solverIterations = _solverIterations;
|
||||
solverVelocityIterations = _solverVelocityIterations;
|
||||
|
||||
isShowIsoBounds = _showIsoBounds;
|
||||
isShowScreenBounds = _showScreenBounds;
|
||||
isSnapByCells = _snapByCells;
|
||||
isSnapByObjects = _snapByObjects;
|
||||
isSortInSceneView = _sortInSceneView;
|
||||
snappingDistance = _snappingDistance;
|
||||
isShowDepends = _showDepends;
|
||||
isShowQuadTree = _showQuadTree;
|
||||
}
|
||||
|
||||
void OnRenderObject() {
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
--- !u!55 &1
|
||||
PhysicsManager:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Gravity: {x: 0, y: 0, z: -9.81000042}
|
||||
serializedVersion: 3
|
||||
m_Gravity: {x: 0, y: 0, z: -9.81}
|
||||
m_DefaultMaterial: {fileID: 0}
|
||||
m_BounceThreshold: 2
|
||||
m_SleepThreshold: .00499999989
|
||||
m_DefaultContactOffset: .00999999978
|
||||
m_SolverIterationCount: 6
|
||||
m_RaycastsHitTriggers: 1
|
||||
m_SleepThreshold: 0.005
|
||||
m_DefaultContactOffset: 0.01
|
||||
m_DefaultSolverIterations: 6
|
||||
m_DefaultSolverVelocityIterations: 1
|
||||
m_QueriesHitBackfaces: 0
|
||||
m_QueriesHitTriggers: 1
|
||||
m_EnableAdaptiveForce: 0
|
||||
m_EnablePCM: 1
|
||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
** TODO Версия 3.1.0
|
||||
*** Код
|
||||
**** TODO Поддержка TiledMap
|
||||
**** TODO Вынести поле для гравитации в IsoWorld
|
||||
**** TODO Возможность вывода баунда только для текущего объекта
|
||||
**** TODO Подсвечивать проникающие друг-в-друга объекты в редакторе
|
||||
**** TODO Возможность невидимых изометрических объектов без сортировки
|
||||
@@ -41,6 +40,9 @@
|
||||
**** TODO Добавить возможность брать объект по позиции мыши без райкаста
|
||||
**** TODO Возможность задавать плоскость проекции изометрических координат
|
||||
**** TODO Было бы удобно иметь кнопку по округлению индексов позиции тайлов
|
||||
** DONE Версия 3.0.2
|
||||
*** Код
|
||||
**** DONE Вынести настройки физики в IsoWorld
|
||||
** DONE Версия 3.0.1
|
||||
*** Баги
|
||||
**** DONE Проблемы с сериализацией дженерик классов
|
||||
|
||||
Reference in New Issue
Block a user