Jitters 3d Engine jit.gl.sketch some initial questions

glitchcord's icon

Hi, I have been using Max as a control surface sending values to Blender3d over OSC, Blender's Game Engine is very good with 3d but theres no cross platform way of getting video into it so im thinking of using Jitter instead. I have a few questions regarding Jitter's OpenGL Engine?

Id like to be able to move preloaded .obj(or whatever) shapes around in 3d space- Does this require jit.gl.sketch and if so which commands should i be looking at?

And how about moving camera's around, also is it possible to have multiple cameras and switch between them- which commands should i be looking at?

Lastly is it possible to edit the vertex's of shapes once they have been loaded in, ie move the corners of an object about?

Thanks very much

Rob Ramirez's icon

look at jit.gl.model for loading obj's.

camera's are linked to the rendering context (gl.render).
you can have multiple rendering context's and switch between them.
however, might be better to simply store your different camera position vectors, and recall them when needed. look at jit.gl.render help file and open the patcher "viewing transforms".

for the last question, this is something that i'm currently looking into. i think the best way to approach this is to manipulate the geometry with vertex shaders, especially if you have some shader programming experience.
i'm sure others have some suggestions on this as well.

theoretically you can do whatever you want with the geometry once it's in jitter world.

just start playing.
-rob

glitchcord's icon

Cheers for the camera help rob, iv sorted that out and got an lcd to move it about with the mouse.

Im wondering if its possible to move the position of an object relative to that objects x,y,z rather than the global xyz.

Is there an easier way to do this than getting stuck into matrices? If not could you let me know what i need to be looking up and what needs to go where!

Rob Ramirez's icon

well, i think your asking if you can tell an object to translate a certain amount in a certain direction, rather than to explicitly set it's position with the "position x y z" message.
there is nothing built in that does that, but all you have to do is store the previous position values, and add your relative translate to the stored position, and send the new calculated position to the object.

maybe have a look at "vexpr". shouldn't have to use matrices at all if you're just moving around gl objects.

glitchcord's icon

right so just to clarify,

theres no built in function to move an object a certain amount along its own x,y or z axis. if i want to rotate an object then move that object to its own left or right (rather than the global left or right) im gonna have to;

1. get the objects position and rotation

2. using the objects position and some hardcore 3d trigonometry find a point in space which is 90 degrees(for left/right) to my objects rotation and say a distance of 20 away.

3.then interpolate between my objects position and the point in space i just found using vexpr or similar.

This seems quite a difficult way just to move an object to its own left or right especially once my object begins rotating along x y and z axis' - does anyone know a patch that does the above- or maybe the "hardcore trig" isnt that hardcore at all?

Andrew Benson's icon

In order to help we will need to know a little more about how you are
doing things:

a. what OpenGL object are you using to draw your geometry?
b. in what way are the position, rotate, or rotatexyz attributes not
working for you.
c. are you looking for a way to do this transform on matrix data? If
so, have a look at jit.traffic (and a primer on linear algebra).

Cheers,
Andrew B.

glitchcord's icon

Hi Andrew,

Right now im just hacking the .help examples to see if its possible to achieve what im after- so im using jit.gl.handle , jit.gl.plato ( i aim to use jit.gl.model to import .obj's) and jit.gl.render

I want to end up with,

a centrally rotating object[object A] (jit.gl.handle)

this object fires out other objects[object B] in a straight line,
so ill hit a key and an object B will emerge from the same position of object A and travel in a straight line away from object A. This straight line will be relative to the rotaton of object A so that if i "fire" another objectB a second after firing the first it will travel out on a slightly different course (because objectA is continually rotating).

I hope that makes sense if not i can post an animation of what im after!

Cheers

Rob Ramirez's icon

sending the "rotate angle, x, y, z" to any gl object will rotate that object about it's local axes (as specified by the xyz args). no need for trigonometry there.

in order to launch an object from the rotated objects "face" or "front" or whatever, you would need to keep track of your objects accumulated angle of rotation, and decide which side of the object is the front. still no need for trigonometry afaik.

you would have to calculate the initial velocity vector for the object that gets launched, which you would get from the angle of rotation of the launcher. will need some trig here i believe.

glitchcord's icon

Thanks guys,

ive been taking a closer look at what im after and i think a particle system is what i need! Ive hooked(hacked) up the shiva example to emit one particle, then patched the particles xyz into a jit.gl.plato's pak position which is making it move! Ive just got to figure a way to convert jit.gl.handle's angle/x/y/z output into pitch and yaw and feed it back into vishnu! Then the particles should emit in in a direction relative to jit.gl.handles rotation. ive think ive got a few more questions coming but ill save them until ive ahd time to take a look at whats going on in the patch.

Thanks for your help