Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
How to rotate vertices ? - Gideros Forum

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# How to rotate vertices ?

Member
edited March 7
Im trying to achieve glass shatter effect, so far the only idea I can come up with is to randomly generate mesh plane with a lots of triangles, select 3-4-or more connected vertices in a group, move and rotate them away. My problem with this is that I can't see how possibly could I rotate group of vertices without involving heavy maths . Was expecting to be able to apply matrix but.. I hit the wall again.

## Comments

• Member
@gemboy100 I know it's not the same thing but the effect should be similar: did you think about using RenderTarget on the groups of vertices and rotate the resulting objects (Sprites/Bitmaps)?
• Member
mesh:setRotationX(mesh:getRotationX()+30)
my games:
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
• Member
@pie Ill try a bit harder to do it with mesh before I go with that : )

@oleg That cmd rotates whole mesh obj, I wanted to rotate only selected vertices from vertexArray, not sure if I was very clear what I want to achieve

• Maintainer
I think you must create a mesh for each glass fragment, then you can move/rotate each fragment independently.

Likes: oleg

+1 -1 (+1 / -0 ) Share on Facebook
• Member
no need to separate meshes, just some basic vector operations, look for tutorials, or classes, e.g. try https://github.com/bjornbytes/maf although it is 3d, you emulate 2d rotation too with it.

Likes: gemboy100

+1 -1 (+1 / -0 ) Share on Facebook
• Member
Accepted Answer
even better, check this https://2dengine.com/?p=vectors

Likes: gemboy100

+1 -1 (+1 / -0 ) Share on Facebook
• Maintainer
Better if it can be done in the single mesh - then still only one object to draw.
• Maintainer

Better if it can be done in the single mesh - then still only one object to draw.

Well not in gideros: lua is rather slow and modifying vertices means reuploading them to GPU. On the other hand gideros rendering pipeline is very close to the GPU, and transforming an existing mesh (rotate/translate) is just a matter of changing its associated transform matrix, which is reuploaded to the GPU on each draw call anyway

Likes: oleg, SinisterSoft

+1 -1 (+2 / -0 ) Share on Facebook
• Member
edited March 10
@keszegh great links, nice and simple tutorial, even I could understand most of it
• Member
hgy29 said:

Well not in gideros: lua is rather slow and modifying vertices means reuploading them to GPU. On the other hand gideros rendering pipeline is very close to the GPU, and transforming an existing mesh (rotate/translate) is just a matter of changing its associated transform matrix, which is reuploaded to the GPU on each draw call anyway

that's surprising, would be interesting to see benchmark comparison.
• Member
http://forum.giderosmobile.com/discussion/1887/improve-performnace-with-mesh

Btw., forum search tool acts kind of weird, I always have to go trough google
 `site:forum.giderosmobile.com word`

Likes: keszegh

+1 -1 (+1 / -0 ) Share on Facebook
• Member
another way could be by using shaders i guess.

Likes: SinisterSoft

+1 -1 (+1 / -0 ) Share on Facebook
Sign In or Register to comment.