Compare commits
No commits in common. "d63d3cedd258ead4ea21d587ec7691753cd766da" and "ba81b9f71d9f7fe3b916a8038cfb9183ab1ec385" have entirely different histories.
d63d3cedd2
...
ba81b9f71d
@ -133,9 +133,9 @@ namespace RoboidControl.Unity {
|
|||||||
rb.velocity = 0.9f * rb.velocity + 0.1f * forwardSpeed * transform.forward;
|
rb.velocity = 0.9f * rb.velocity + 0.1f * forwardSpeed * transform.forward;
|
||||||
rb.angularVelocity = 0.9f * rb.angularVelocity + 0.1f * turningSpeed * Vector3.up;
|
rb.angularVelocity = 0.9f * rb.angularVelocity + 0.1f * turningSpeed * Vector3.up;
|
||||||
|
|
||||||
core.ReplacePosition(LinearAlgebra.Spherical.FromVector3(this.transform.localPosition));
|
core.position = LinearAlgebra.Spherical.FromVector3(this.transform.localPosition);
|
||||||
core.ReplaceOrientation(LinearAlgebra.SwingTwist.FromQuaternion(this.transform.localRotation));
|
core.orientation = LinearAlgebra.SwingTwist.FromQuaternion(this.transform.localRotation);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,6 @@ namespace RoboidControl.Unity {
|
|||||||
|
|
||||||
#if GLTF
|
#if GLTF
|
||||||
bool loadingModel = false;
|
bool loadingModel = false;
|
||||||
|
|
||||||
private async void ProcessGltfModel(RoboidControl.Thing coreThing) {
|
private async void ProcessGltfModel(RoboidControl.Thing coreThing) {
|
||||||
if (!loadingModel) {
|
if (!loadingModel) {
|
||||||
loadingModel = true;
|
loadingModel = true;
|
||||||
@ -193,7 +192,7 @@ namespace RoboidControl.Unity {
|
|||||||
Thing[] things = FindObjectsOfType<Thing>();
|
Thing[] things = FindObjectsOfType<Thing>();
|
||||||
Thing parentThing = null;
|
Thing parentThing = null;
|
||||||
foreach (Thing thing in things) {
|
foreach (Thing thing in things) {
|
||||||
if (thing.core != null && thing.core.owner.networkId == coreThing.owner.networkId && thing.core.id == coreThing.id) {
|
if (thing.core.owner.networkId == coreThing.owner.networkId && thing.core.id == coreThing.id) {
|
||||||
parentTransform = thing.transform;
|
parentTransform = thing.transform;
|
||||||
parentThing = thing;
|
parentThing = thing;
|
||||||
}
|
}
|
||||||
@ -213,8 +212,7 @@ namespace RoboidControl.Unity {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ScanForThings(parentTransform);
|
ScanForThings(parentTransform);
|
||||||
|
}
|
||||||
AddMeshColliders(parentTransform); }
|
|
||||||
else {
|
else {
|
||||||
this.transform.localScale = Vector3.one * 1;
|
this.transform.localScale = Vector3.one * 1;
|
||||||
}
|
}
|
||||||
@ -264,15 +262,6 @@ namespace RoboidControl.Unity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddMeshColliders(Transform rootTransform) {
|
|
||||||
MeshRenderer[] meshRenderers = rootTransform.GetComponentsInChildren<MeshRenderer>();
|
|
||||||
foreach (MeshRenderer meshRenderer in meshRenderers) {
|
|
||||||
MeshFilter meshFilter = meshRenderer.GetComponent<MeshFilter>();
|
|
||||||
MeshCollider meshCollider = meshRenderer.gameObject.AddComponent<MeshCollider>();
|
|
||||||
meshCollider.sharedMesh = meshFilter.sharedMesh;
|
|
||||||
meshCollider.convex = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a Pose event
|
/// Handle a Pose event
|
||||||
|
@ -316,10 +316,6 @@ namespace RoboidControl {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool positionUpdated = false;
|
public bool positionUpdated = false;
|
||||||
|
|
||||||
public void ReplacePosition(Spherical newPosition) {
|
|
||||||
this._position = newPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SwingTwist _orientation = SwingTwist.zero;
|
private SwingTwist _orientation = SwingTwist.zero;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The orientation of the thing in local space
|
/// The orientation of the thing in local space
|
||||||
@ -340,10 +336,6 @@ namespace RoboidControl {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool orientationUpdated = false;
|
public bool orientationUpdated = false;
|
||||||
|
|
||||||
public void ReplaceOrientation(SwingTwist newOrientation) {
|
|
||||||
this._orientation = newOrientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Spherical _linearVelocity = Spherical.zero;
|
private Spherical _linearVelocity = Spherical.zero;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The linear velocity of the thing in local space in meters per second
|
/// The linear velocity of the thing in local space in meters per second
|
||||||
|
Loading…
x
Reference in New Issue
Block a user