playMaker

Author Topic: Set Uvs Coordinates[SOLVED]  (Read 13061 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #15 on: October 28, 2013, 05:16:48 AM »
Hi,

 It works here, I think you are simply not properly setting the base values, so it doesn't match any uvs.

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #16 on: October 28, 2013, 06:11:30 AM »
Very strange!

I pay attention to basic values ​​(here uv base values ​​of the cube)

Another strange thing , the values ​​displayed by UV "mouse pick uv" remains that of the original mesh and does not change when I move the uvs while the texture changes color!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #17 on: October 28, 2013, 08:45:08 AM »
Hi,

 your uv values showned for the cube are wrong, uv ranges from 0.0 to 1.0, so what script are you using the get these values?

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #18 on: October 28, 2013, 11:09:20 AM »
This is an imported cube Blender, the script told me exactly the same values ​​as in Blender.

Here is the script

Code: [Select]
#pragma strict
 
public var theCube : Transform;
private var theUVs : String = "";

function Start ()
{
    if (theCube == null)
        theCube = this.transform;
 
    var theMesh : Mesh = theCube.GetComponent(MeshFilter).mesh as Mesh;
     
    theUVs = theUVs + "(" + theMesh.uv.length.ToString() + ") :";
     
    for (var i:int = 0; i < theMesh.vertices.length; i ++) {
       
        theUVs = theUVs + "  " + i + "=" + theMesh.uv[i].ToString();
       
    }
}
 
function OnGUI ()
{
    GUI.Label( Rect( 10, Screen.height * 0.25, Screen.width - 20, Screen.height * 0.25), "UVs " + theUVs );
 
}

Having said that, with the following script, I can move my UVs ... but when I use "mouse select uv'' to the new coordinates, it does not work, I always start UV coordinates, have you any idea? Merci
Code: [Select]
#pragma strict
 
public var theCube : Transform;

function MoveUV_1 ( UVf : float)
{
     if (theCube == null)
        theCube = this.transform;
 
    var theMesh : Mesh = theCube.GetComponent(MeshFilter).mesh as Mesh;
  var UVs : Vector2[] = new Vector2[theMesh.uv.Length];
    UVs = theMesh.uv;
   
 for (var i:int = 0; i < theMesh.vertices.length; i ++) {
 
 if (UVs[i].x == 0.1){
       
  UVs[i] = Vector2 (0.1, UVf);
  }
 
 theMesh.uv = UVs;
             
 
  }
     
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #19 on: October 29, 2013, 02:19:19 AM »
Hi,

 Then, pm me with this object and your scene if you can, cause it works ok with all the tests I carried over.

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #20 on: October 29, 2013, 03:55:19 AM »
Hi,

Here the scene.

Reminder of malfunctions:

1 / If UV base is defined, the coordinates UV targets are defined in 0.0
2 / When I move the uv,  "Mouse Pick UV" always gives my old coordinates and not the news!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #21 on: October 29, 2013, 05:10:30 AM »
Hi,

 You need to package the scene, otherwise, I won't have the model and the texture.

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #22 on: October 29, 2013, 05:59:40 AM »
sorry

Here the package

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #23 on: October 29, 2013, 08:22:25 AM »
Hi,

 Ok, thanks, I could find the problem! Thanks for the scene, it helped me finding what exactly I was doing wrong in my tests. Can you redownload from the original post, ti should work fine now.

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #24 on: October 29, 2013, 10:05:47 AM »
It works fine now, thanks  :)

The new coordinates are not displayed by "pick mouse UV" do you know why?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #25 on: October 30, 2013, 01:27:06 AM »
Hi,

 Maybe you should wait one frame, the mesh update cycle maybe not done yet.

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #26 on: October 30, 2013, 03:30:07 AM »
Hi Jean,

Uv pixel is set to "every frame". the strange thing is that the texture changes is OK (that means that the mesh is updated, right?) but we still have the old UV coordinates! The problem is visible on the package that I sent yesterday.

Thank you for your help.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #27 on: October 30, 2013, 08:29:30 AM »
Hi,

Try to put a mesh collider on the cube. A box collider will not work.


bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #28 on: October 30, 2013, 10:32:28 AM »
Even with <Mesh collider> I do not have the new UV coordinates, and the old coordinates are displayed <Mouse Pick Uv>!
I think <Mouse Pick Uv> ignores changes to a mesh prefab in real time (execution)!

thank you

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #29 on: October 31, 2013, 08:06:46 AM »
Hi,

 Good catch, What happens is that editing a mesh can be done locally, or actually to the mesh on the asset folder ( the shared mesh), and then ALL components using this mesh will actually see the changes.

Redownload the action, it nows has options to "Affect shared mesh" when you set UV.

Bye,

 Jean