changing rotate point

May 19, 2008 at 1:56pm

changing rotate point

Max 4.6.3

I’ve been trying to get my head around this for weeks now, basically i’m creating a 3D visual environment that is synced up with an ambisonics audio environment (sound objects and visual objects move around together)…

what i really need to be able to do is change the pivot (rotate point) point for all the objects in the scene (where the camera will be) then move all the objects in that relative direction… i figured this might be possible using jit.gl.sketch however i can’t figure out how to change the rotate point of the sketch scene…

any ideas?

#37879
May 19, 2008 at 2:57pm

This isn’t hard to do, but are you sure you wouldn’t rather rotate the camera itself, rather than rotate all the objects? Here’s a sample patch, rotating the camera around its current point in world space.

max v2;
#N vpatcher 606 181 1183 755;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 357 319 29 196617 t f b;
#P window linecount 2;
#P newex 144 480 248 196617 jit.gl.gridshape door @shape cube @poly_mode 1 1 @scale 50 10 50 @color 0. 1. 0.4 @lighting_enable 1;
#P window linecount 1;
#P comment 187 364 14 196617 z;
#P comment 155 364 14 196617 y;
#P comment 117 364 14 196617 x;
#P comment 143 347 45 196617 camera;
#P comment 276 307 45 196617 lookat;
#P flonum 181 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 144 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 70 403 123 196617 pak camera 0. 0. 2.;
#P comment 317 324 14 196617 z;
#P comment 285 324 14 196617 y;
#P flonum 310 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 238 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 274 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 310 405 27 196617 + 2.;
#P newex 310 376 27 196617 f 0.;
#P newex 274 405 27 196617 + 0.;
#P newex 274 376 27 196617 f 0.;
#P newex 238 405 27 196617 + 0.;
#P newex 238 376 27 196617 f 0.;
#P newex 357 273 55 196617 pak 1. 0.;
#P flonum 357 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 404 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 402 249 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 402 224 143 196617 expr ($f1/180.) * 3.141593;
#P newex 357 297 57 196617 poltocar;
#P newex 202 431 91 196617 pak lookat 0. 0. 0.;
#P hidden newex 402 65 72 196617 loadmess 180;
#P newex 402 201 40 196617 % 360;
#P newex 402 177 37 196617 + 270;
#P user dial 402 84 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 window linecount 2;
#P newex 16 515 124 196617 jit.window door @size 640 480 @depthbuffer 1;
#P window linecount 1;
#P newex 16 449 50 196617 t b erase;
#P window linecount 2;
#P newex 16 480 125 196617 jit.gl.render door @erase_color 0. 0. 0. 1.;
#P window linecount 1;
#P newex 16 426 51 196617 qmetro 2;
#P toggle 16 403 15 0;
#P comment 247 324 14 196617 x;
#P window setfont “Sans Serif” 14.;
#P comment 48 31 467 196622 ROTATING LOOKAT AROUND Y AXIS RELATIVE TO CAMERA COORDS;
#P window setfont “Sans Serif” 9.;
#P comment 382 67 128 196617 rotate lookat around y axis;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 1 5 0;
#P fasten 12 0 5 0 207 473 21 473;
#P fasten 30 0 5 0 75 473 21 473;
#P connect 6 0 5 0;
#P connect 31 0 30 1;
#P connect 32 0 30 2;
#P connect 33 0 30 3;
#P connect 20 0 12 1;
#P fasten 17 0 19 0 362 361 243 361;
#P lcolor 8;
#P connect 26 0 19 0;
#P connect 19 0 20 0;
#P fasten 31 0 20 1 112 399 260 399;
#P lcolor 4;
#P connect 22 0 12 2;
#P fasten 40 1 21 0 381 367 279 367;
#P lcolor 8;
#P connect 25 0 21 0;
#P connect 21 0 22 0;
#P connect 24 0 12 3;
#P fasten 32 0 22 1 149 399 296 399;
#P lcolor 4;
#P fasten 16 0 23 0 409 373 315 373;
#P lcolor 8;
#P connect 27 0 23 0;
#P connect 23 0 24 0;
#P fasten 33 0 24 1 186 399 332 399;
#P lcolor 4;
#P connect 18 0 13 0;
#P connect 13 0 40 0;
#P connect 40 0 17 0;
#P hidden connect 11 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 18 1;
#P connect 13 1 16 0;
#P pop;

#131174
May 19, 2008 at 3:22pm

3dmatrix of jash is very good…dont know in jitter…

On 19 May 2008, at 14:56, Ian McKinlay wrote:

>
> Max 4.6.3
>
> I’ve been trying to get my head around this for weeks now,
> basically i’m creating a 3D visual environment that is synced up
> with an ambisonics audio environment (sound objects and visual
> objects move around together)…
>
> what i really need to be able to do is change the pivot (rotate
> point) point for all the objects in the scene (where the camera
> will be) then move all the objects in that relative direction… i
> figured this might be possible using jit.gl.sketch however i can’t
> figure out how to change the rotate point of the sketch scene…
>
> any ideas?

#131175
May 19, 2008 at 3:40pm

Thanks Zachary, I’ll look into that patch… the reason i’m doing it in this strange way (rather than rotating just the camera) is to maintain perfect sync with the ambisonics monitor… which spits out coords for each point.

it doesn’t need up or down… just wolfenstein 3d style movement simulated… i figure if i move all the objects (grouped into one jit.gl.sketch) then keep moving the pivot point to where the camera is, i should be able to simulate going forward, back and rotating just fine…. unless there is something else i’m overlooking?

any other help welcome (:

Quote: Zachary Seldess wrote on Mon, 19 May 2008 22:57
—————————————————-
> This isn’t hard to do, but are you sure you wouldn’t rather rotate the camera itself, rather than rotate all the objects? Here’s a sample patch, rotating the camera around its current point in world space.
>
> max v2;
> #N vpatcher 606 181 1183 755;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #P newex 357 319 29 196617 t f b;
> #P window linecount 2;
> #P newex 144 480 248 196617 jit.gl.gridshape door @shape cube @poly_mode 1 1 @scale 50 10 50 @color 0. 1. 0.4 @lighting_enable 1;
> #P window linecount 1;
> #P comment 187 364 14 196617 z;
> #P comment 155 364 14 196617 y;
> #P comment 117 364 14 196617 x;
> #P comment 143 347 45 196617 camera;
> #P comment 276 307 45 196617 lookat;
> #P flonum 181 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 144 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 107 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 70 403 123 196617 pak camera 0. 0. 2.;
> #P comment 317 324 14 196617 z;
> #P comment 285 324 14 196617 y;
> #P flonum 310 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 238 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 274 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 310 405 27 196617 + 2.;
> #P newex 310 376 27 196617 f 0.;
> #P newex 274 405 27 196617 + 0.;
> #P newex 274 376 27 196617 f 0.;
> #P newex 238 405 27 196617 + 0.;
> #P newex 238 376 27 196617 f 0.;
> #P newex 357 273 55 196617 pak 1. 0.;
> #P flonum 357 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 404 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 402 249 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 402 224 143 196617 expr ($f1/180.) * 3.141593;
> #P newex 357 297 57 196617 poltocar;
> #P newex 202 431 91 196617 pak lookat 0. 0. 0.;
> #P hidden newex 402 65 72 196617 loadmess 180;
> #P newex 402 201 40 196617 % 360;
> #P newex 402 177 37 196617 + 270;
> #P user dial 402 84 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 window linecount 2;
> #P newex 16 515 124 196617 jit.window door @size 640 480 @depthbuffer 1;
> #P window linecount 1;
> #P newex 16 449 50 196617 t b erase;
> #P window linecount 2;
> #P newex 16 480 125 196617 jit.gl.render door @erase_color 0. 0. 0. 1.;
> #P window linecount 1;
> #P newex 16 426 51 196617 qmetro 2;
> #P toggle 16 403 15 0;
> #P comment 247 324 14 196617 x;
> #P window setfont “Sans Serif” 14.;
> #P comment 48 31 467 196622 ROTATING LOOKAT AROUND Y AXIS RELATIVE TO CAMERA COORDS;
> #P window setfont “Sans Serif” 9.;
> #P comment 382 67 128 196617 rotate lookat around y axis;
> #P connect 3 0 4 0;
> #P connect 4 0 6 0;
> #P connect 6 1 5 0;
> #P fasten 12 0 5 0 207 473 21 473;
> #P fasten 30 0 5 0 75 473 21 473;
> #P connect 6 0 5 0;
> #P connect 31 0 30 1;
> #P connect 32 0 30 2;
> #P connect 33 0 30 3;
> #P connect 20 0 12 1;
> #P fasten 17 0 19 0 362 361 243 361;
> #P lcolor 8;
> #P connect 26 0 19 0;
> #P connect 19 0 20 0;
> #P fasten 31 0 20 1 112 399 260 399;
> #P lcolor 4;
> #P connect 22 0 12 2;
> #P fasten 40 1 21 0 381 367 279 367;
> #P lcolor 8;
> #P connect 25 0 21 0;
> #P connect 21 0 22 0;
> #P connect 24 0 12 3;
> #P fasten 32 0 22 1 149 399 296 399;
> #P lcolor 4;
> #P fasten 16 0 23 0 409 373 315 373;
> #P lcolor 8;
> #P connect 27 0 23 0;
> #P connect 23 0 24 0;
> #P fasten 33 0 24 1 186 399 332 399;
> #P lcolor 4;
> #P connect 18 0 13 0;
> #P connect 13 0 40 0;
> #P connect 40 0 17 0;
> #P hidden connect 11 0 8 0;
> #P connect 8 0 9 0;
> #P connect 9 0 10 0;
> #P connect 10 0 14 0;
> #P connect 14 0 15 0;
> #P connect 15 0 18 1;
> #P connect 13 1 16 0;
> #P pop;
>
—————————————————-

#131176
May 19, 2008 at 4:45pm

Check out this thread from a month or so ago: Look at ondandoff’s attached patch. This may help.

http://www.cycling74.com/forums/index.php?t=msg&goto=137110&rid=3109&S=026e991fbe26e6abbef538adac217fde#msg_137110

#131177
May 20, 2008 at 8:14am

Ah yup, that one hit the nail on the head… figured it out now. Basically just using jit.gl.sketch as another layer so we can perform the translate before the rotate. ah so simple, and here was me trying to figure out the trig to move points in the direction of rotation (i’m new to 3D gfx) (: Huge thanks.

Very impressive work you’ve been doing to (:

Quote: Zachary Seldess wrote on Tue, 20 May 2008 00:45
—————————————————-
> Check out this thread from a month or so ago: Look at ondandoff’s attached patch. This may help.
>
> http://www.cycling74.com/forums/index.php?t=msg&goto=137110&rid=3109&S=026e991fbe26e6abbef538adac217fde#msg_137110
—————————————————-

#131178

You must be logged in to reply to this topic.