How to get x,y,z texture position of a face?
-
Hi,
I want to extract the x,y,z texture position so that Animatex animates texture from the original texture position because right now is not doing that. What is doing is starting from the x,y,z value user inputs. For example if the user input 2 on the x axis the the texture start from 2 then 4,6,8,10,12 and so on. This can have a negative impact if the user want to animate projected faces.
What I want is for scrip to get the original x position of the texture lets say it is x=3 and the if user type 2 for the x speed then texture will start form 3 then 5,7,9,11,13 and so on.
I hope that was clear if not please let me know and I will do better job explaining it.
So far my problem is that when I try to retrieve texture position using the code below I get multiple x,y,z values (4 to be exact) instead of one.
model = Sketchup.active_model entities = model.active_entities sel = model.selection[0] ; face = sel uv_helper = face.get_UVHelper true, true #, my_texture_writer # I get error if I don't put # face.outer_loop.vertices.each do |vert| uvq = uv_helper.get_front_UVQ(vert.position) puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s UI.messagebox uvq end
Anyways, I hope that with the help of the community this can be solved since animating projected textures is being requested.
-
You have limited API access to texture information.
You can easily find the XYZ of a face... BUT then matching the face's texture to that is the trip.
Look at my 'TextureTools' to see how I reposition textures [Nudge etc] etc...
http://sketchucation.com/forums/viewtopic.php?p=329765#p329765
The XYZ [UVQ] data is got in a particular way...
You don't actually need to know where the face.material.texture is 'located' initially IF you apply 'relative' offsets to its UVs [using a transformation] it can 'slide' across the face by that amount ? -
Thank you TIG as always and I will look into your recommendation ASAP!
Advertisement