playMaker

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

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Set Uvs Coordinates[SOLVED]
« on: October 25, 2013, 02:55:59 AM »
Hello,

You can do this with PlayMaker? :
Set all Uvs vector with coordinates (x1, y1) of the game object to new coordinates (x2, y2).

Thank you for your help
« Last Edit: October 31, 2013, 11:40:41 AM by logiquefloue »

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Set Uvs Coordinates
« Reply #1 on: October 25, 2013, 04:32:15 AM »
Yes, you can drag the material (or any other component) on to your fsm state 'sheet' and you are offered to get/ set properties for whatever the component has exposed, with materials you can get/set the x and y of uv's for example.

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #2 on: October 25, 2013, 04:46:32 AM »
Thank you for the answer.

But I can not find in the properties "UV coordinates" of the game object. for more information, I want to move the coordinates of the mesh of the object and not the material (texture)

thank you

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Set Uvs Coordinates
« Reply #3 on: October 25, 2013, 04:57:30 AM »
Sorry misunderstood that. No UV's are not available for editing straight out of the box AFAIK. There are some UV editing packs on asset store but don't know if they offer variable movement.

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Set Uvs Coordinates
« Reply #4 on: October 25, 2013, 05:04:29 AM »
Maybe there's another way to get what you want without tweaking UV's ?

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #5 on: October 25, 2013, 05:15:31 AM »
I made this script that works (I started in the program), if anyone can transform into action PlayMaker to enjoy everyone ...

Code: [Select]
#pragma strict
 
public var theCube : Transform;

function Start ()
{
 var x1 : float = 0.0;
 var y1 : float = 0.0;
 var x2 : float = 1.0;
 var y2 : float = 1.0;

     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] == Vector2 (x1,y1)){
       
  UVs[i] = Vector2 (x2, y2);
  }
 
 theMesh.uv = UVs;
             
 
  }
     
}

I try to animate the uv coordinates to simulate a rise in temperatures of an object. I made a texture dérgadée (from red to blue) and I want to move the uvs depending on the temperatures.

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #6 on: October 25, 2013, 06:03:01 AM »
I use "mouse pick uv" to trace the UV coordinates.
When I change the uv coordinates via script, "mouse pick uv" does not give me the new coordinates, but it still shows me the original details! (Uv map made in Blender)

Any idea?


logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #8 on: October 25, 2013, 08:26:48 AM »
Thank you, but the action moves all uv mesh. True?
I'm looking to control a uv mesh in an individual way (with a selection of initial coordinates)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #9 on: October 26, 2013, 03:18:33 AM »
Hi,

 Simply adapt the script you made with that custom action, Have you tried?

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #10 on: October 26, 2013, 05:33:30 AM »
Hi,

 Simply adapt the script you made with that custom action, Have you tried?

bye,

 Jean

Hello Jean

I tried but my programming skills are minimal. but I'm still at same point. must share all frame works because the variable is calculated by equations

thank you

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #11 on: October 26, 2013, 09:08:21 AM »
Hi,

 Ok, I think the current behavior that you created will cause massive performance hit if you stat using it on big meshes. You would be better storing references of UV indexes against temperatures and only adjust the one you need to change, in your case, this means that ALL uvs are scanned for ALL changes, that 99% do not apply.

But anyway here's a custom action for this. If you are having trouble making it work, let me know.

Bye,

 Jean
« Last Edit: October 31, 2013, 08:10:23 AM by jeanfabre »

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #12 on: October 27, 2013, 12:13:22 PM »
Hello John and thank you for action ...

The filter is not working.
1 / When I chose a base value, all coordinates are set (0.0)! not to the target value
2 / When no base value is selected, all coordinates are set to target value (this function very well)

You're right, it is not necessary that this function every frame.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Uvs Coordinates
« Reply #13 on: October 28, 2013, 01:21:50 AM »
Hi,

 Could you provide a repro scene? I am not sure what's wrong here.

bye,

 Jean

logiquefloue

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Set Uvs Coordinates
« Reply #14 on: October 28, 2013, 04:48:34 AM »
Hello jean,

I do not put A scene in this post a scene! Here are some screen printing.

When one of the values ​​(base) of the filter is set, all UVS targets are set (0.0)