Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Location
    Turin
    Posts
    129

    Strange Terrain Editor Error

    As I've described in the video linked below, I run into a strange problem. Everythink work good until but than the terrain patches are added wrong.
    See the video for more detail link: https://www.dropbox.com/s/bhxbyweokz...roblem%201.wmv
    Best regards, Alberto.

  2. #2
    Join Date
    Mar 2011
    Location
    Turin
    Posts
    129
    Any one can help me?

  3. #3
    Join Date
    Mar 2013
    Location
    Australia
    Posts
    217
    I haven't build this myself but its hard to tell without seeing the code for InRange and RemovePatch


    I'm trying to understand what it does a bit. Is it generating patch objects and then disabling /enabling based on the position and distance from the character. Then if they are to far away instead of leaving those patch objects hanging around it destroys them.

    If this is the case the line you comment out is what destroys them. But seeming as your only getting one patch generated maybe its not an issue there but an issue with the part of the code that regenerates the patch when you walk into an area where there are none. My guess is that line destroys all the ones that are to far away when you start up so you see the issue when you get closer.

  4. #4
    Join Date
    Mar 2011
    Location
    Turin
    Posts
    129
    Thank you for the help. When i get back 8 try to check a little more the code that create the patch.

  5. #5
    Join Date
    Mar 2011
    Location
    Turin
    Posts
    129
    This is my code for InRange and RemovePatch:

    InRange
    Code:
     public static bool InRange(Vector2 p1, Vector2 p2, float range)
            {
                if (Mathf.Abs(p1.x - p2.x) <= range && Mathf.Abs(p1.y - p2.y) <= range)
                    return true;
    
                return false;
            }
    RemovePatch
    Code:
     public static bool InRange(Vector2 p1, Vector2 p2, float range)
            {
                if (Mathf.Abs(p1.x - p2.x) <= range && Mathf.Abs(p1.y - p2.y) <= range)
                    return true;
    
                return false;
            }

  6. #6
    Join Date
    Mar 2013
    Location
    Australia
    Posts
    217
    I think you pasted InRange method twice instead of the Remove Patch.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •