## Rotation point – How to not in center??

Jun 14, 2008 at 4:17pm

# Rotation point – How to not in center??

Dear Jitterlist!!
I think this little question have more solutions, but in this time I’m don’t know anyone ((

How to change center of rotating point if I need it not in center of gridshape, but in one of it’s corner ???
And another important thing – I have many gridshapes and all of it need to rotate in same direction and have same point of rotating!! So solution with rotation all of rendered world is no good way (

In the end of work it’s must be a model of human moving using Wiimote and camera. That you’re can suppose – I need joint(articulation) to model body!

Cheers

#P toggle 220 158 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 40 55 440 355;
#P outlet 229 201 15 0;
#P outlet 192 202 15 0;
#P inlet 75 73 15 0;
#P outlet 155 202 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 254 76 62 9109513 metro 1300;
#P message 254 114 45 9109513 \$1 1300;
#P newex 254 95 57 9109513 random 360;
#P newex 254 131 40 9109513 line 500;
#P newex 190 131 40 9109513 line 500;
#P newex 190 95 57 9109513 random 360;
#P message 190 114 41 9109513 \$1 900;
#P newex 190 76 55 9109513 metro 900;
#P toggle 126 40 24 0;
#P newex 126 76 62 9109513 metro 1000;
#P message 126 114 45 9109513 \$1 1000;
#P newex 126 95 57 9109513 random 360;
#P newex 126 131 40 9109513 line 500;
#P comment 154 44 185 9109513 < - turn on mood machine;
#P connect 15 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 1 0;
#P connect 1 0 14 0;
#P connect 5 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 7 0;
#P connect 7 0 9 0;
#P connect 9 0 16 0;
#P connect 10 0 17 0;
#P connect 5 0 13 0;
#P connect 13 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 10 0;
#P pop;
#P newobj 220 179 83 9109513 p mood_machine;
#P comment 234 159 111 9109513 < - turn on mood machine;
#P flonum 292 204 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 256 204 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 220 204 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 191 236 98 9109513 pak rotatexyz 0. 0. 0.;
#P newex 191 259 84 9109513 jit.gl.handle output;
#P toggle 106 148 15 0;
#P newex 106 199 45 9109513 t b erase;
#P newex 106 171 40 9109513 metro 2;
#P newex 106 236 83 9109513 jit.gl.render output;
#P newex 106 258 76 9109513 jit.window output;
#P newex 191 282 390 9109513 jit.gl.gridshape output @lighting_enable 1 @shape cube @scale -0.3 -0.8 0.1 @position 0 0 -2.4;
#P connect 12 2 10 0;
#P connect 12 1 9 0;
#P connect 12 0 8 0;
#P connect 13 0 12 0;
#P connect 6 0 0 0;
#P connect 7 0 6 0;
#P connect 10 0 7 3;
#P connect 9 0 7 2;
#P connect 8 0 7 1;
#P connect 4 1 2 0;
#P connect 4 0 2 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P window clipboard copycount 14;

#38408
Jun 17, 2008 at 5:02pm

On Sat, Jun 14, 2008 at 5:17 PM, outoff wrote:

>
> How to change center of rotating point if I need it not in center of
> gridshape, but in one of it’s corner ???
> And another important thing – I have many gridshapes and all of it need to
> rotate in same direction and have same point of rotating!! So solution with
> rotation all of rendered world is no good way (
>
> In the end of work it’s must be a model of human moving using Wiimote and
> camera. That you’re can suppose – I need joint(articulation) to model body!
>
>
This would be easier to do using a procedural language like JS or Lua, where
you have full control over the OpenGL state. I’m sure you can do it in a
patch, but I can’t tell you how, and I think it’ll gets very messy very
quickly.

This is how you do it using opengl commands:
-translate the object so that 0,0,0 is located at one or its corners.
-rotate
-translate inverse amount

Now your object will be back where it was, but rotated around the corner
point. You can use glTranslate and glRotate for it, in combination with the
gridshape drawraw method. Drawraw lets the object use the current
transformation, instead of resetting the OpenGL state to the position and
rotation attributes on drawing. You don’t want that, because otherwise your
gl* transforms don’t have any effect.

If you plan to do use this kind of thing to build a skeleton, you definitely
want to go the procedural route. Look into “scenegraph”. You want to cascade
matrix transformations to build a skeleton.

You can find the basics the OpenGL redbook, as always.

I know one book, which I can recommend, that has an example:
“Essential mathematics for games & interactive applications” page 148.

I had to struggle with this book since my math background is really poor,
overkill for you though… I’m sure you can find tutorials online as well.

Sorry for the somewhat overly complicated response. Hope it’s helpful.

Thijs

#133942
Jun 18, 2008 at 11:09am

yep-yep! thanks! any information is helpful)
how do you think, may be this commands are understands by jit.gl.sketch? cause languages like js it’s seems to difficult within some education((

thanks again!!

#133943
Jun 18, 2008 at 12:25pm

On Wed, Jun 18, 2008 at 12:09 PM, outoff wrote:

>
> yep-yep! thanks! any information is helpful)
> how do you think, may be this commands are understands by jit.gl.sketch?
> cause languages like js it’s seems to difficult within some education((
>

Yes jit.gl.sketch will do, although I’ve never really understood why people
use it. I personally find Javascript/Lua a lot easier to work with.

I do think it’s really essential to learn a procedural language in addition
to Max. It might seem a bit difficult to start with, but it’s really not any
more difficult than patching. Both approaches are just very different.
Patching is great in a lot of ways, but some things are really hard or
nearly impossible to do in a patch, while they might be easy to implement in
a procedural way. Only when you know both you can choose the right tool for
the job.

My 2c,
Thijs

#133944
Jun 18, 2008 at 12:50pm

I agree with Thijs regarding learning a procedural language. But in this case, you may get what you want quite easily with sketch.

Check out this thread from a few months ago: Look at ondandoff’s attached patch. This may help.