On Fri, Apr 4, 2008 at 12:27 PM, Derrick Giscloux <<a href="mailto:derrickgiscloux@free.fr">derrickgiscloux@free.fr</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Is there a way to rotate an object not by the center (as rotate or rotatexyz messages can do) but like you open a door for example ?<br>
<br></blockquote><div><br>If you use <a href="http://jit.gl">jit.gl</a> objects and with drawraw instead of draw/bang you control the T/R/S yourself. If you use normal draw() the object is doing a local-to-world transformation by applying scale->rotate->translate with the set attributes (scale/rotate/position). The same would be if you do (pseudo code):<br>
<br>glScale(object.scale)<br>glRotate(object.rotate)<br>glTranslate(object.position)<br>object.drawraw()<br><br>The advantage of using drawraw would be that you can add and change this local-to-world transformation in any way you like. For a door to rotate around its edge, you would add something like:<br>
<br>glTranslate(object.widt/2, 0, 0)<br>glRotate(doorRotation)<br><br>Note that the order of translate/rotate is different here. Order of function calls is extremely important. You'll get something completely different if you reverse the order. A lot of times I figure these things out with a bit of trial-and-error, so I can't tell you from the top of my head in which order the above should be combined to get the right result. You can find proper info on these things in the opengl redbook (or any book including basic 3d math) and numerous online resources. You could do the above with jit.gl.sketch, JS, Lua, C, ...<br>
<br>Hope this helps.<br><br>Thijs<br><br><br><br><br> <br></div></div><br>