Search Unity

Repeat geometry over and over

Discussion in 'Scripting' started by Tapgames, Feb 24, 2012.

  1. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi All,

    I have a issue that i'm unable to solve. I have made a screw/turbine that is drilling down the model is 10 units high and is perfecly stackable in maya and unity.

    Now I have a script that is checking when the screw is -10 units reset it to 10 so that the screw/turbines keep stacking, repeating and drilling down.

    The problem is that there is a gap between them.

    Is it my script or do I have to do this in a different approach?

    Any help appreciated :)

    Roy


    Turbine.js
    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. public var twister : Transform;
    5. var turbineEnd = -10.0;
    6. var speed = -1.0;
    7. var twist = 108;
    8.  
    9.     function Update() {
    10.    
    11.     transform.position.y += Time.deltaTime * speed;
    12.     transform.Rotate(0, Time.deltaTime * twist, 0);
    13.          
    14.     if (transform.position.y <= turbineEnd)
    15.      
    16.         transform.position.y = 10;
    17.     }
    18.  
     

    Attached Files:

  2. flaminghairball

    flaminghairball

    Joined:
    Jun 12, 2008
    Posts:
    868
    Could it be that the rotation doesn't match between the two?
     
  3. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi FlamingHairball,

    It's now rotated by script I also tried a animation done by maya the same result.

    Btw, there are two prefabs with that script in the scene. It starts oke but when the first goes back to the top it;s out of sync.

    Roy
     
  4. flaminghairball

    flaminghairball

    Joined:
    Jun 12, 2008
    Posts:
    868
    If it doesn't work in Maya, then it sounds like your model doesn't loop seamlessly.
     
  5. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    sorry i meant in maya is everthing okay but not in unity. same result with keyframe animation from maya to unity.
     
    Last edited: Feb 24, 2012
  6. flaminghairball

    flaminghairball

    Joined:
    Jun 12, 2008
    Posts:
    868
    Ah, ok. Could you upload a copy of the mesh for testing?
     
  7. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Sure, :)
     

    Attached Files:

  8. flaminghairball

    flaminghairball

    Joined:
    Jun 12, 2008
    Posts:
    868
    Don't have Maya sorry - .FBX or .obj maybe?
     
  9. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Fbx version,
     

    Attached Files:

  10. flaminghairball

    flaminghairball

    Joined:
    Jun 12, 2008
    Posts:
    868
    Hey,

    I'm not seeing an issue on my system - if you'd like to send over a test scene I'd be happy to take a look.

    Regards,

    -Lincoln Green
     
  11. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi FlamingHairball,

    I started a new clean project and now it works :D wierd.

    Thank you for you time!

    Roy