Commit 61fdeae6 authored by Zsanet Sueli's avatar Zsanet Sueli
Browse files

changed MapTeleportToCurvedArea Script, did not solve the problem

parent 0b902d7f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1213,8 +1213,8 @@ Transform:
  serializedVersion: 2
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
  m_LocalPosition: {x: 3.50457, y: 0.125, z: 1.80414}
  m_LocalScale: {x: 1, y: 1, z: 1}
  m_ConstrainProportionsScale: 0
  m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
  m_ConstrainProportionsScale: 1
  m_Children: []
  m_Father: {fileID: 0}
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -14324,7 +14324,7 @@ MonoBehaviour:
  teleportAction: {fileID: -8061240218431744966, guid: c348712bda248c246b8c49b3db54643f,
    type: 3}
  steps: 1000
  stepSize: 0.05
  stepSize: 0.5
--- !u!1 &1202312658
GameObject:
  m_ObjectHideFlags: 0
@@ -21507,8 +21507,8 @@ Transform:
  serializedVersion: 2
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
  m_LocalPosition: {x: 3.50457, y: 0.125, z: 1.80414}
  m_LocalScale: {x: 1, y: 1, z: 1}
  m_ConstrainProportionsScale: 0
  m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
  m_ConstrainProportionsScale: 1
  m_Children: []
  m_Father: {fileID: 0}
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+0 −6
Original line number Diff line number Diff line
@@ -189,12 +189,6 @@ public class CurvedWorldManager : MonoBehaviour
    public void RecomputeLuts()
    {


     //double aParamMax = origin.y / 100000;  
  //  double safetyMargin = 1.1; // 10% Puffer
   // double aMaxForLUT = aParamMax * safetyMargin;

  //  ArcLength = new ArcLength(aMaxForLUT, curveSize, xMax, xSize, lMax, lSize);
        ArcLength = new ArcLength(curveMax, curveSize, xMax, xSize, lMax, lSize);
        Texture2D InverseArcLengthLUTTexture = ArcLength.GetInverseArcLengthTexture();
        InverseArcLengthLUTTexture.Apply();
+5 −7
Original line number Diff line number Diff line
@@ -73,10 +73,9 @@ public class MapTeleportToCurvedArea : MonoBehaviour
        hit = Vector3.zero;
        if (playerRig == null) return false;

        Vector3 origin = curvedWorld.origin;
        Vector3 p = ray.origin;

        Vector3 start = p;
        Vector3 start = p * 0;  //work in local coordinates
        Vector3 end; 

        for (int i = 0; i < steps; i++)
@@ -89,17 +88,16 @@ public class MapTeleportToCurvedArea : MonoBehaviour
            
            Instantiate(ballRed, p, Quaternion.identity);

            Vector3 startStraight = Transforms.Curved2Straight3D(start, curvedWorld.Curvature, curvedWorld.ArcLength);
            Vector3 startStraight = Transforms.Curved2Straight3D(start, curvedWorld.Curvature, curvedWorld.ArcLength); // Point on the Curved Terrain

            Instantiate(ballBlue, startStraight, Quaternion.identity);

            Vector3 endStraight = Transforms.Curved2Straight3D(end, curvedWorld.Curvature, curvedWorld.ArcLength);
            Vector3 endStraight = Transforms.Curved2Straight3D(end, curvedWorld.Curvature, curvedWorld.ArcLength); // Transformed point on the falt Curve
            Debug.Log($"startStraight={startStraight}, endStraight={endStraight}");
            RaycastHit rcHit;
           
            float tolerance = 1.0f;
            float target = 0f;
            if (Physics.Linecast(start, end, out rcHit))
            
            if (Physics.Linecast(startStraight + ray.origin, endStraight + ray.origin, out rcHit))
            {
                
                Debug.Log("Hit Test wurde ausgeführt");
+3 −2
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public static class Transforms
        return (arcLen.LengthFunction(a, xQ), Math.Sign(y - yQ) * distancePQ);
    }


    /// <summary>
    /// Transform a point (x, y, z) from curved world to straight world.
    /// </summary>
@@ -100,8 +101,8 @@ public static class Transforms

        var (distanceStraight, yStraight) = Curved2Straight2D(distance, y, a, arcLen);

        double xStraight = distanceStraight / distance * x;
        double zStraight = distanceStraight / distance * z;
        double xStraight = distanceStraight *  x / distance;
        double zStraight = distanceStraight * z / distance;

        return (xStraight, yStraight, zStraight);
    }
+23195 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading