Mentions légales du service

Skip to content
Snippets Groups Projects

Teleportation

Merged BRUNEAU Julien requested to merge julbrune/chaos_dev:master into master
1 file
+ 40
38
Compare changes
  • Side-by-side
  • Inline
@@ -369,11 +369,11 @@ public class FollowTrajectory : MonoBehaviour
Vector3 LocalTargetSupOnTrajectory = new Vector3();
Vector3 newPos;
//bool hide = false;
//if (vInfInWorld[0] < -50 || vInfInWorld[0] > 50 || vInfInWorld[2] < -25 || vInfInWorld[2] > 25)
//if (vInfInWorld[0] < -14|| vInfInWorld[0] > 14|| vInfInWorld.y< -14 || vInfInWorld.y> 14)
// hide = true;
//if (vSupInWorld[0] < -50 || vSupInWorld[0] > 50 || vSupInWorld[2] < -25 || vSupInWorld[2] > 25)
//if (vSupInWorld[0] < -14|| vSupInWorld[0] > 14|| vSupInWorld.y< -14 || vSupInWorld.y> 14)
// hide = true;
////Debug.Log("hide => " + hide);
//Debug.Log(vInfInWorld + "---" + vSupInWorld);
if (_bApplyFilter)
{
GetFilter().SmootPosition(fCurrentTime, _iCurrentIndex, out LocalTargetInfOnTrajectory, out LocalTargetSupOnTrajectory);
@@ -394,41 +394,43 @@ public class FollowTrajectory : MonoBehaviour
Vector3 oldPos = new Vector3(this.transform.localPosition.x, 0.0f, this.transform.localPosition.z);
_Speed = Vector3.Magnitude(oldPos - newPos) / Time.deltaTime;
_Speed = Vector3.Magnitude(vSupInWorld - vInfInWorld) / Time.deltaTime;
//Debug.Log("_Speed => " + _Speed);
//if (hide)
//{
// for (int i = 1; i < transform.childCount; ++i)
// {
// transform.GetChild(i).gameObject.SetActive(false);
// }
// foreach (Transform child in transform)
// {
// //Debug.Log(child.gameObject);
// Renderer rend = child.gameObject.GetComponent<Renderer>();
// if (rend != null)
// {
// rend.enabled = false;
// }
// }
//}
//else
//{
// for (int i = 1; i < transform.childCount; ++i)
// {
// transform.GetChild(i).gameObject.SetActive(true);
// }
// foreach (Transform child in transform)
// {
// //Debug.Log(child.gameObject);
// Renderer rend = child.gameObject.GetComponent<Renderer>();
// if (rend != null)
// {
// rend.enabled = true;
// }
// }
//}
Debug.Log("_Speed => " + _Speed);
if (_Speed>5 && Time.deltaTime>0)
{
//Debug.Log("hide => " + hide);
for (int i = 0; i < transform.childCount; ++i)
{
transform.GetChild(i).gameObject.SetActive(false);
}
foreach (Transform child in transform)
{
//Debug.Log(child.gameObject);
Renderer rend = child.gameObject.GetComponent<Renderer>();
if (rend != null)
{
rend.enabled = false;
}
}
}
else
{
for (int i = 0; i < transform.childCount; ++i)
{
transform.GetChild(i).gameObject.SetActive(true);
}
foreach (Transform child in transform)
{
//Debug.Log(child.gameObject);
Renderer rend = child.gameObject.GetComponent<Renderer>();
if (rend != null)
{
rend.enabled = true;
}
}
}
if (_Speed > 0)
{
Loading