Bonjour,
alors voila j'ai fait un cercle de triangle de triangle et je voudrais que chaque triangle sois orienté vers le centre du cercle. J'ai recherché un peu partout sur le net et j'ai vu qu'il y avait glm::angle qui servait à ce genre de chose mais je n'arrive pas à obtenir l'effet désiré ....
voici mon code :
J'ai vu aussi qu'il y avait orientedAngle mais je n'ai pas très bien compris la différence avec glm::angle ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 void transform::circle(float radius, glm::vec3 center){ for(int i = 0; i < numObject; i++){ float rel = i / (float)numObject; float angle = rel * M_PI * 2; glm::vec3 position = glm::vec3(cos(angle), sin(angle), 0.f); position.x *= radius + center.x; position.y *= radius + center.y; translation = glm::translate(glm::mat4(1.0f), position); float angle = glm::angle(position, center); rotation = glm::rotate(glm::mat4(1.0f), angle, glm::vec3(0, 0, 1)); modelObject.at(i) = translation * rotation * baseScale; } }
Je vous remercie d'avance pour votre aide.
Partager