lookat parameter for gridshape

nicolasnuzillard's icon

Hello!

I'm trying to create a lookat parameter for a jit.gl.multiple because apparently, the parameter doesn't exist.

I'm trying to creat one with jit.expr, but my gridshapes don't converge

Max Patch
Copy patch and select New From Clipboard in Max.

Maybe there is another way to do it.

nicolasnuzillard's icon

ok, so there is improvement, but there is a problem with negative values

Max Patch
Copy patch and select New From Clipboard in Max.

any help ?

`

nicolasnuzillard's icon

Done !

I cheated a bit a the end because I was being sick of doing trigonometry.
Anyway it works :)

Max Patch
Copy patch and select New From Clipboard in Max.

Please tell me if there is a better way:)

Pedro Santos's icon

By your description, I don't understand your intent. The lookat parameter doesn't make sense in jit.gl.multiple, jit.gl.gridshape or any other "object". It makes sense in jit.gl.render (where you define the OpenGL camera) or better yet, in jit.gl.camera (Max 6).

I guess I'm not understanding what you're trying to accomplish... I'm certain I'm missing something.

Max Patch
Copy patch and select New From Clipboard in Max.

Anyway, here it goes, a clarification of the lookat message. Good luck.

nicolasnuzillard's icon

I want many objects to look a particular point,
I'm using trigonometry in order to find the angle between any of my multiple object and a particular mooving target, I tested the patch again, it seems to work.

Lookat is avaliable for cameras and lights but not for gridshapes .

Andro's icon

Not behind the computer but you can plug a jit.anim.node into an object and then send it the lookat co-ordinates eg. lookat 0. 0. 0.
You maybe have to turn locklook to 1 for it to work.

nicolasnuzillard's icon

This won't work because all the the duplicated objects will look in a parallel direction as the original object. I want an effect of convergeance.

Andro's icon

Not sure if your right there. If all the objects are at different points in 3d space and they're all told to look at 0. 0. 0. then they should all look independently.
Then again not behind my computer with Max so I can't check your patch.

Andrew Benson's icon

Cool idea! Not necessarily better, but I took the liberty of porting your jit.exprs into a single jit.gen object

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

jit.gl.multiple cannot be used in conjunction with jit.anim.node. it will simply modify the original object, and therefore every object will have the same rotation.

cool patch nicolas, glad you figured out a solution using the maths.

nicolasnuzillard's icon

I want to make big mooving eyes that follows people beyond the screen mouahahaha !!
By the way, thanks for optimising my patch, jit.expr is usefill but quite heavy!

nicolasnuzillard's icon

In my project, I use a shader (a controllable mask) and a texture that are automatically applied to the -x face of the cubes.
In the above patch, the z face is orienting it self to the target, I want the -x face to lookat the moving cube.
If I use a rotation on my gridshape, it will change the disposition (position) of all my cubes because of the "position" glparams of my jit.gl.multiple.
Is it possible to rotatexyz a gridshape without changing the axes, without cheating with a pass to jit.gl.mesh (because it's being complicated to transmit a shader and a mapped texture) in order to change the face that look at my target?

Nicolas