Forums > Jitter

Rotate an object in its own coordinate system… probably basic but I can't find

January 15, 2014 | 2:54 am

Hello,

I’m beginning using jitter, and I have some problems understanding coordinates systems and basic operations on it in 3D view.
I looked at Max help, forums and website, but I can’t find a way to make a rotation of an object, using floats driven by knobs, of a 3D object, around its own axis.

In the following patch :
- I put a platonic solid in the world "Landscape" ;
- Landscape axes and Plato axes are on ;
- and I would like to rotate Plato axis around its own x-axis only (i.e. its red axis) ; then move it around y-axis (i.e. its blue one) without having any other rotations around x- or z-axis.

Actually, by hitting "reset" and rotating around X-Plato, the behavior is what I expect. But if then I change only Y-axis value, Plato is turning around an unknown axis…

Can you help please ?

Also, if you have good ressources to explain the camera system and position, and the cooridnates system in jitter (world and object), it would be very usefull. I’m confused with rotate/rotatexyz…

Thanks a lot.

Attachments:
  1. 3D_Rotation.maxpat

January 15, 2014 | 3:19 am

I highly recommend going through the tutorials in Max for Jitter. They are really excellent.
Help menu->jitter tutorials.
Tutorial 30 and 32 provide good reading and examples you can learn from step by step.


January 15, 2014 | 3:40 am

Thanks for your quick reply !

I had again a carefull look at these two tutorials, but I can’t find a way to do what I want… rotation of the object with mouse is okay, but I do not see how to block two axis and make the rotation only around one of them, with mouse or better with seperate dials (1 for each axis).

I continue searching…

(and by the way, yes, Max tutorials are really excellent… that’s part of the big effieciency of the environment)

( if Cyclin’ can had a graphical view with definition of common notions in jitter/OpenGL, that would be nice :) )


January 15, 2014 | 5:09 am

I think, Tutorial 30 has very close to what you are seeking. Take a look at it again.
Right side, light blue area, a pak combining angle, x, z, y into a rotate message.
This does a angle of rotation around a rotation vector/axis

http://en.wikipedia.org/wiki/Axis_angle

The rotatexyz message does a euler rotation around the traditional X Y Z axis. In Max 6, the default is to do Y first, Z second, and X third.

http://en.wikipedia.org/wiki/Euler_angles#Euler_rotations

perhaps make some dials, get theiir output values, combine into a message like rotatexyz


January 15, 2014 | 7:03 am

I had a new look on Tutorial 30 – you’re right, it’s close, but I’m not able to rotate the text along one of its axis only, after having made a first rotation.

Let’s say after showing the axes, I give an angle then define x= 1. Okay, good movement.
Then how do I say : "move only around green axis, keeping the x-orientation as previously defined" ?

I keep trying with rotatexyz, rotate order, on the jti.gl.render object ; I try to understand the jit.gl.camera, lookat, position, etc… on both jit.gl.render and jit.gl.camera.

I think I don’t understand the basic theory of cam/world etc. ; and from what I get from the tutorials and Internet, I can’t from the moment understand how this work.


January 15, 2014 | 8:59 am

Start simple. Worry about camera, world, and other things later.

Every rotatexyz message you send sets the attribute called "rotatexyz". You can see it in the inspector for the object. Sending a message or setting it in the inspector completely negates any previous setting. So, if you want to do two rotations, then you must combine them together in the same message.

Its just like the color attribute. If you send it the RGBA value "1. 0. 0. 1." then it will make the object red. Now if you send it the color "0. 1. 0. 1." it will be green. It doesn’t combine the two colors together…it forget the previous color and uses the new one.

rotatexyz is exactly the same.

After you master rotating single objects, there are some other things you can do with jit.anim.node


January 16, 2014 | 2:49 am

Okay, I removed everything from my mind except "rotatexyz", and message combination :)
In a previous patch I did a control of the color attribute that worked fined (update of only one channel, keeping others at the same value).
I tried here with rotate xyz, I can’t make it…

Let say I have an object on screen (plato), with both axis rendered : screen and world.
I put attrui on the jit.gt.plat, looking at rotatexyz. I change the value to 45. 45. 45.
Perfect.
Now I change only x value on attrui-rotatexyz : rotation around x-object axis, perfect.
But if I change only Y or Z value, nok : rotation axis are different from object ones. It looks like there are world ones. But for X it’s always ok.

I do no know the combination I have to make…


January 16, 2014 | 2:50 am

sorry :
"Let say I have an object on screen (plato), with both axis rendered : OBJECT and world."

thanks ! :)


January 16, 2014 | 3:53 am

I think there is a gap between what you want and what I’m understanding you want. I’m unsure how to help you. Could you draw on a piece of paper or video what you want, scan it, and post it here?


January 16, 2014 | 12:01 pm

encelade, you need to use the anim_turn message, and change the @anim_mode attribute from the default of "parent" to "local".
this allows you to rotate around specific local axes.

this patch should explain it.

<code>

– Pasted Max Patch, click to expand. –

</code>


January 17, 2014 | 4:33 pm

Diablodale, sorry for reply late, my post was not send, I thought it was…
I prepared 3 pictures for the problem and an explanation.. :)

Rob, yes this is what I wanted – perfect, and perfect patch !

Thanks a lot to both of you for your help :)


January 18, 2014 | 2:54 am

oh……that was your question.
Glad Rob recognized it. :-)


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