Forums > Jitter

rotate opening a door

April 4, 2008 | 11:27 am

Hello,

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 ?

thank you.


April 4, 2008 | 11:29 am

another example, jit.gl.text3d allows that with "align" message.


April 4, 2008 | 2:00 pm

Here’s an quick example achieved by rotating the render context. Doing this with object-space transformations is very possible, it just takes a bit more time. I don’t think there’s a built-in way to offset the rotational center of an object, so you’d need to use a bit of trig and simultaneously rotate and reposition. I can do this later maybe when I have more time. Or perhaps I’m wrong about there being no built-in way??

best,
Zachary

max v2;
#N vpatcher 767 104 1085 487;
#P window setfont "Sans Serif" 9.;
#P hidden newex 159 22 72 196617 loadmess 270;
#P newex 159 182 39 196617 !- 360;
#P newex 159 158 40 196617 % 360;
#P newex 159 134 31 196617 + 90;
#P user dial 159 41 85 85 359 1 0 0 159 359 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 197 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 159 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 123 226 108 196617 pak rotatexyz 0. 0. 0.;
#P flonum 123 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 32 304 219 196617 jit.gl.gridshape door @shape plane @scale 0.3 0.5 1. @color 0.5 1. 0.7 1. @position 0.3 0. 0.;
#P window linecount 1;
#P newex 32 281 224 196617 jit.window door @size 640 480 @depthbuffer 1;
#P newex 32 228 50 196617 t b erase;
#P newex 32 259 201 196617 jit.gl.render door @erase_color 0. 0. 0. 1.;
#P newex 32 205 51 196617 qmetro 2;
#P toggle 32 182 15 0;
#P connect 0 0 1 0;
#P connect 1 0 3 0;
#P connect 3 0 2 0;
#P connect 3 1 2 0;
#P fasten 7 0 2 0 128 251 37 251;
#P fasten 6 0 7 1 128 223 160 223;
#P hidden connect 14 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 8 0;
#P fasten 8 0 7 2 164 223 192 223;
#P fasten 9 0 7 3 202 223 224 223;
#P pop;


April 4, 2008 | 3:56 pm

Procrastination…

Here is the more subtle solution – rotating the object relative to its own object-space.

Zachary

max v2;
#N vpatcher 606 181 1325 704;
#P window setfont "Sans Serif" 14.;
#P window linecount 1;
#P comment 403 72 212 196622 ADJUST ROTATIONAL CENTER;
#P window setfont "Sans Serif" 9.;
#P comment 564 382 45 196617 scale;
#P comment 301 313 45 196617 position;
#P flonum 606 399 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 569 399 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 532 399 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 495 423 123 196617 pak scale 0.3 0.5 1.;
#P comment 203 33 128 196617 rotate plane around y axis;
#P comment 349 330 14 196617 z;
#P comment 317 330 14 196617 y;
#P flonum 342 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 270 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 306 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 460 330 29 196617 t b f;
#P newex 413 330 29 196617 t b f;
#P newex 342 396 27 196617 + 0.;
#P newex 342 371 27 196617 f 0.;
#P newex 306 396 27 196617 + 0.;
#P newex 306 371 27 196617 f 0.;
#P newex 270 396 27 196617 + 0.;
#P newex 270 371 27 196617 f 0.;
#P newex 413 262 55 196617 pak 0.3 0.;
#P flonum 413 309 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 460 309 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 413 238 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 458 238 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 458 213 143 196617 expr ($f1/180.) * 3.141593;
#P newex 413 286 57 196617 poltocar;
#P newex 234 423 120 196617 pak position 0. 0. 0.;
#P hidden newex 223 31 72 196617 loadmess 270;
#P newex 223 194 39 196617 !- 360;
#P newex 223 167 40 196617 % 360;
#P newex 223 143 31 196617 + 90;
#P user dial 223 50 85 85 359 1 0 0 159 359 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 261 218 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 223 218 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 187 238 108 196617 pak rotatexyz 0. 0. 0.;
#P flonum 187 218 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 234 454 215 196617 jit.gl.gridshape door @shape plane @scale 0.3 0.5 1. @color 0.5 1. 0.7 1. @position 0. 0. 0.;
#P newex 17 142 124 196617 jit.window door @size 640 480 @depthbuffer 1;
#P window linecount 1;
#P newex 17 79 50 196617 t b erase;
#P window linecount 2;
#P newex 17 110 125 196617 jit.gl.render door @erase_color 0. 0. 0. 1.;
#P window linecount 1;
#P newex 17 56 51 196617 qmetro 2;
#P toggle 17 33 15 0;
#P comment 279 330 14 196617 x;
#P window linecount 2;
#P comment 307 228 104 196617 this should match the object’s x scale –>;
#P window setfont "Sans Serif" 14.;
#P comment 403 30 279 196622 ROTATING AN OBJECT RELATIVE TO ITS OBJECT-SPACE AROUND Y AXIS;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 5 0;
#P connect 6 1 5 0;
#P fasten 9 0 10 1 192 235 224 235;
#P hidden connect 17 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 11 0;
#P fasten 40 0 8 0 500 448 239 448;
#P connect 18 0 8 0;
#P fasten 10 0 8 0 192 444 239 444;
#P fasten 11 0 10 2 228 235 256 235;
#P connect 35 0 26 0;
#P fasten 32 0 26 0 418 365 275 365;
#P lcolor 4;
#P connect 26 0 27 0;
#P connect 27 0 18 1;
#P fasten 12 0 10 3 266 235 288 235;
#P fasten 32 1 27 1 437 390 292 390;
#P lcolor 7;
#P connect 34 0 28 0;
#P connect 28 0 29 0;
#P connect 29 0 18 2;
#P connect 36 0 30 0;
#P fasten 33 0 30 0 465 367 347 367;
#P lcolor 4;
#P connect 30 0 31 0;
#P connect 31 0 18 3;
#P fasten 33 1 31 1 484 393 364 393;
#P lcolor 7;
#P connect 41 0 22 0;
#P lcolor 13;
#P connect 22 0 25 0;
#P connect 25 0 19 0;
#P connect 19 0 24 0;
#P connect 24 0 32 0;
#P fasten 15 0 20 0 228 188 463 188;
#P connect 20 0 21 0;
#P connect 21 0 25 1;
#P connect 19 1 23 0;
#P connect 23 0 33 0;
#P connect 41 0 40 1;
#P connect 42 0 40 2;
#P connect 43 0 40 3;
#P pop;


April 4, 2008 | 4:49 pm

Yes,
It is exactly what I need to do, especially your second patch.

I had a look at jasch’s [3dmatrix] object too, but I can’t figure if it could be used with open GL.

thank you again
:-)


April 4, 2008 | 4:57 pm

In fact,
it is for a theater project where 3 screens could move back and forward, like a door.

look at the pic.


April 4, 2008 | 4:58 pm

and


April 4, 2008 | 4:59 pm

last.


Viewing 8 posts - 1 through 8 (of 8 total)