Skip to content

Commit

Permalink
Merge branch 'main' into docs/use_galactic_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mackierx111 committed Dec 20, 2022
2 parents ea6652c + b6ccc8e commit 7208aeb
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &880058119
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 500668027171818776}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5deb375b0b4281647baa5032c1b0fba0, type: 3}
m_Name:
m_EditorClassIdentifier:
duration: 30
speed: 1
--- !u!1 &1041813113
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -21825,6 +21811,20 @@ MonoBehaviour:
materialIndex: 2
- bulbType: 1
materialIndex: 3
--- !u!114 &880058119
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 500668027171818776}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5deb375b0b4281647baa5032c1b0fba0, type: 3}
m_Name:
m_EditorClassIdentifier:
duration: 30
speed: 1
--- !u!1 &851514381789785374
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -22903,6 +22903,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
mgrsOffsetPosition: {x: 81655.73, y: 50137.434, z: 42.49998}
mgrsGridZone: 54SUE
--- !u!1 &7285300991010974236
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22765,7 +22765,7 @@ MeshRenderer:
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: e9f6c123297306c43ad64cf3b2b7768d, type: 2}
- {fileID: 2100000, guid: 451aea9b91355944e8c8b22453d23245, type: 2}
- {fileID: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
Expand Down Expand Up @@ -23810,6 +23810,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
mgrsOffsetPosition: {x: 81655.73, y: 50137.434, z: 42.49998}
mgrsGridZone: 54SUE
--- !u!1 &9133155309130949695
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ MonoBehaviour:
centerOfMassTransform: {fileID: 2963107001226707149}
useInertia: 0
inertia: {x: 0, y: 0, z: 0}
sleepVelocityThreshold: 0.04
sleepVelocityThreshold: 0.02
SkiddingCancelRate: 0.606
frontAxle:
leftWheel: {fileID: 2963107000584003440}
Expand Down
11 changes: 10 additions & 1 deletion Assets/AWSIM/Scripts/Environments/Environment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ public class Environment : SingletonMonoBehaviour<Environment>
[SerializeField]
Vector3 mgrsOffsetPosition;

[SerializeField]
string mgrsGridZone;

/// <summary>
/// Reference point of Autoware's MGRS coordinate system.
/// Reference point of MGRS coordinate system. (e.g. Tokyo is "54SUE")
/// </summary>
/// <see href="https://maps.gsi.go.jp/#9/35.499810/138.854828/&base=std&ls=std&disp=1&vs=c1g1j0h0k0l0u1t0z0r0s0m0f1"></see>
public Vector3 MgrsOffsetPosition => mgrsOffsetPosition;

/// <summary>
/// MGRS Grid Zone.
/// </summary>
public string MgrsGridZone => mgrsGridZone;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ IEnumerator Loop()
yield return RotateRoutine(0.5f, 360f);
yield return MoveForwardRoutine(duration, speed);
yield return RotateRoutine(0.5f, 360f);
transform.position = startPosition;
transform.rotation = startRotation;
var npcTransformPos = npcPedestrian.transform.position;

// reset
npcPedestrian.SetPosition(startPosition);
npcPedestrian.SetRotation(startRotation);
currentPosition = startPosition;
currentRotation = startRotation;
}
}

Expand Down
15 changes: 15 additions & 0 deletions Assets/AWSIM/Scripts/Vehicles/Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ public class Axle
Vector3 lastPosition;
Quaternion lastRotation;

// Sleep position & rotation
Vector3 sleepPositon;
Quaternion sleepRotation;
bool lastSleep;

void Awake()
{
m_rigidbody = GetComponent<Rigidbody>();
Expand Down Expand Up @@ -254,6 +259,7 @@ void FixedUpdate()
lastVelocity = m_rigidbody.velocity;
lastPosition = m_transform.position;
lastRotation = m_transform.rotation;
lastSleep = sleep;

// ----- inner methods -----

Expand Down Expand Up @@ -340,6 +346,12 @@ bool IsCanSleepInput()

void UpdateVehicleSleep(bool isSleep)
{
if (isSleep == true && lastSleep == false)
{
sleepPositon = transform.position;
sleepRotation = transform.rotation;
}

// Vehicle sleep.
if (isSleep)
{
Expand All @@ -348,6 +360,9 @@ void UpdateVehicleSleep(bool isSleep)

m_rigidbody.Sleep();
m_rigidbody.constraints = RigidbodyConstraints.FreezeAll;

transform.position = sleepPositon;
transform.rotation = sleepRotation;
}
else
{
Expand Down
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

21 changes: 19 additions & 2 deletions Assets/RGLUnityPlugin/Scripts/SceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ private static IEnumerable<RGLObject> IntoRGLObjectsHybrid(IEnumerable<GameObjec
if (renderer is MeshRenderer mr)
{
var mf = mr.GetComponent<MeshFilter>();
if (mf.sharedMesh == null)
{
Debug.LogWarning($"Shared mesh of {mr.gameObject} is null, skipping");
continue;
}
yield return MeshFilterToRGLObject(mf);
}
}
Expand All @@ -298,11 +303,21 @@ private static IEnumerable<RGLObject> IntoRGLObjectsUsingMeshes(IEnumerable<Game
if (renderer is MeshRenderer mr)
{
var mf = mr.GetComponent<MeshFilter>();
if (mf.sharedMesh == null)
{
Debug.LogWarning($"Shared mesh of {mr.gameObject} is null, skipping");
continue;
}
yield return MeshFilterToRGLObject(mf);
}

if (renderer is SkinnedMeshRenderer smr)
{
if (smr.sharedMesh == null)
{
Debug.LogWarning($"Shared mesh of {smr.gameObject} is null, skipping");
continue;
}
// SkinnedMesh cannot be shared
string meshId = $"s#{go.GetInstanceID()}";
RGLSkinnedMesh rglSkinnedMesh = new RGLSkinnedMesh(meshId, smr);
Expand Down Expand Up @@ -376,8 +391,10 @@ private static IEnumerable<Renderer> GetUniqueRenderersInGameObjects(IEnumerable
{
smrs.Add(smr);
}

if (gameObject.TryGetComponent<MeshRenderer>(out var mr) && mr.enabled)

bool hasMeshRenderer = gameObject.TryGetComponent<MeshRenderer>(out var mr) && mr.enabled;
bool hasMeshFilter = gameObject.TryGetComponent<MeshFilter>(out _); // Mesh filter can't be disabled
if (hasMeshRenderer && hasMeshFilter)
{
mrs.Add(mr);
}
Expand Down

0 comments on commit 7208aeb

Please sign in to comment.