Moving a curved face/surface  Topic is solved

Moving a curved face/surface

Postby Frankn » Wed Jan 20, 2021 4:45 am

As the title says, how do I move the curved face/surface? I'm able to iterate and get the individual faces and I tried
Code: Select all
face[0].pushpull distance
within the loop but the faces take off in different directions.

I tried
Code: Select all
face[0].transform!([0, distance, 0]))
but that doesn't work.

I also tried adding the faces to selection and doing something with that but I can't get anything to work.


curved face.jpg


Re: Moving a curved face/surface  Topic is solved

Postby Frankn » Thu Jan 28, 2021 7:12 pm

Found this post which helped me find the solution...

Here's the code I'm using with some notes... if something can be improved or changed please let me know? I can also add the code to iterate the faces if needed?

Basically you need the vertices of all the faces you want to move and each vertex needs a cooresponding vector to be moved to. That way you can pass the 2 arrays to
Code: Select all
transform_by_vectors(vertices, vectors)
. Andif you're using sub components like I am, make sure you're in the correct entities context (not sure I'm using all the proper terminology here) oe else you get a mess as a result.

Like Tig explained in the post I shared...
... if every vector has a separate vector-transformation you need to pass two full arrays - in one go!

Code: Select all
vectors=[]  //array of position to move vertices
vertices=[] //array of face vertices from the individual faces that make up the surface

vertices.flatten!  //in my case I need to flatten the array
vertices.uniq!     //make sure there are no duplicate vertex

  position.x +=distance
  vectors.push vector.position.vector_to(position)
component_entity.transform_by_vectors(vertices, vectors)

Hopefully this helps others out because it wasn't easy to find or understand... but it works!


SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Ad Machine 


Return to Developers' Forum

Who is online

Users browsing this forum: da_li, rrobinson83 and 10 guests

Visit our sponsors: