Skip to content

Commit

Permalink
CLOiSim-3.0.5
Browse files Browse the repository at this point in the history
[Major Changes]

* Upgrade Unity editor version: 2021.3.16f1 (LTS)
* Update package version
  - com.unity.burst: 1.7.3 -> 1.8.2

[Minor Changes]

[Bug fix]

 * Device.Elevator: Bug fix the problem that elevator can't carry a robot.
  • Loading branch information
hyunseok-yang authored Dec 28, 2022
1 parent 3b39b28 commit 86f9e94
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 35 deletions.
73 changes: 43 additions & 30 deletions Assets/Scripts/CLOiSimPlugins/Modules/LiftControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ public class LiftControl : MonoBehaviour
void Awake()
{
rootModel = Main.WorldRoot;
rootModelTransform = rootModel.transform;
}

void Start()
{
rootModelTransform = rootModel.transform;

lift.SetTarget(transform);
lift.SetInitialPose(transform.localPosition);
lift.SetMovingType(Actuator.MovingType.SmoothDamp);
Expand All @@ -58,12 +57,12 @@ public void SetFinishedEventListener(UnityAction call)

private void FindFloorRegionInLift()
{
var colliders = transform.GetComponentsInChildren<MeshCollider>();
foreach (var collider in colliders)
var collisions = transform.GetComponentsInChildren<SDF.Helper.Collision>();
foreach (var collision in collisions)
{
if (collider.name.Equals(floorColliderName))
if (collision.name.Equals(floorColliderName))
{
floorCollider = collider;
floorCollider = collision.GetComponentInChildren<MeshCollider>();
floorCollider.convex = false;
}
}
Expand Down Expand Up @@ -98,7 +97,6 @@ private void DetectObjectsToLiftAndLiftIt()
if (floorCollider != null && floorCollider.bounds.Contains(topModelPosition))
{
hashsetLiftingObjects.Add(topModel);

topModel.transform.SetParent(transform, true);
}
}
Expand All @@ -108,9 +106,9 @@ private void DetectObjectsToLiftAndLiftIt()
private void DropLiftedObjects()
{
// Unlink parenting between lifted objects if arrived at the target floor.
foreach (var obj in hashsetLiftingObjects)
if (rootModelTransform != null)
{
if (rootModelTransform != null)
foreach (var obj in hashsetLiftingObjects)
{
obj.transform.SetParent(rootModelTransform, true);
}
Expand All @@ -129,15 +127,30 @@ public void MoveTo(in float targetHeight)
}

private IEnumerator DoLifting()
{;
{
var waitForEOF = new WaitForEndOfFrame();

const float NEW_POSE_MARGIN = 0.005f;
do
{
lift.Drive();
foreach (var obj in hashsetLiftingObjects)
{
// find root articulation body and teleport the body following as
var articulationBodies = obj.GetComponentsInChildren<ArticulationBody>();
foreach (var articulationBody in articulationBodies)
{
if (articulationBody.isRoot)
{
articulationBody.Sleep();
var newWorldPose = articulationBody.transform.position;
newWorldPose.y = transform.localPosition.y + NEW_POSE_MARGIN;
articulationBody.TeleportRoot(newWorldPose, articulationBody.transform.localRotation);
break;
}
}
}
yield return waitForEOF;

} while(lift.IsMoving);
} while (lift.IsMoving);

DropLiftedObjects();

Expand All @@ -146,21 +159,21 @@ private IEnumerator DoLifting()
yield return null;
}

// #if UNITY_EDITOR
// // just for test
// void Update()
// {
// if (!lift.IsMoving)
// {
// if (Input.GetKeyUp(KeyCode.U))
// {
// MoveTo(600);
// }
// else if (Input.GetKeyUp(KeyCode.J))
// {
// MoveTo(-600);
// }
// }
// }
// #endif
// #if UNITY_EDITOR
// // just for test
// void Update()
// {
// if (!lift.IsMoving)
// {
// if (Input.GetKeyUp(KeyCode.U))
// {
// MoveTo(600);
// }
// else if (Input.GetKeyUp(KeyCode.J))
// {
// MoveTo(-600);
// }
// }
// }
// #endif
}
4 changes: 2 additions & 2 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"hash": "0fc6f532e4f47d66d173314efcb906bc7cf0d00f"
},
"com.unity.burst": {
"version": "1.7.3",
"version": "1.8.2",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"source": "builtin",
"dependencies": {
"com.unity.mathematics": "1.2.1",
"com.unity.burst": "1.7.3",
"com.unity.burst": "1.8.2",
"com.unity.render-pipelines.core": "12.1.8",
"com.unity.shadergraph": "12.1.8"
}
Expand Down
3 changes: 2 additions & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 3.0.4
bundleVersion: 3.0.5
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down Expand Up @@ -502,6 +502,7 @@ PlayerSettings:
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
switchUseNewStyleFilepaths: 0
switchUseLegacyFmodPriorities: 1
switchUseMicroSleepForYield: 1
switchEnableRamDiskSupport: 0
switchMicroSleepForYieldTime: 25
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.14f1
m_EditorVersionWithRevision: 2021.3.14f1 (eee1884e7226)
m_EditorVersion: 2021.3.16f1
m_EditorVersionWithRevision: 2021.3.16f1 (4016570cf34f)

0 comments on commit 86f9e94

Please sign in to comment.