Forums > MaxMSP

Getting xyz position data from jit.phys.body while using the jit.phys.picker obj


Apr 27 2012 | 6:41 am

I’ve been looking through the forum and can’t seem to find an answer. This may be a really stupid question but I was wondering how to go about getting the position data of an object (x y and z) when I move/throw it around using the jit.phys.picker object. I assumed there would be a way to get it from the dumpout of the Jit.phys.body object, but I haven’t been able to figure it out.

Apr 30 2012 | 4:57 pm

send the "getposition" message to the object, and the current position attribute will be sent out the dump outlet.
this is the same as any jitter object attribute, so if this is unfamiliar to you, make sure you check the documentation on jitter attributes.

May 01 2012 | 6:54 pm

Very helpful…wondering why the message isn’t included in the pop-up menu. Is it that you can send "getposition" or whatever other attribute, and it’ll be reported? That would make sense to not include them all, if that’s the case.

Another question, what’s the easiest way to get collision information? Does this have to be through the [dict] object, or can you get it more directly? It seemed a little confusing and I couldn’t quite get it right, or very easily.

LOVE the new physics objects! Just need to figure them out… :)

May 01 2012 | 8:21 pm

yeah, that’s how attributes work.
check out this page for more info:
http://cycling74.com/docs/max6/dynamic/c74_docs.html#jitterwhatareattributes

and yes, phys.world outputs the collisions as dictionaries.
here’s a patch demonstrating how to properly iterate a collisions dictionary.
let me know if anything is unclear.

-- Pasted Max Patch, click to expand. --

May 02 2012 | 1:19 pm

That’s great, thanks very much. I think the "dictionary-of-dictionaries" part was confusing me, I need to read up more on [dict] itself. The collisions info makes sense now.

Time to play!

Jul 15 2012 | 8:26 pm

I may be missing something but how do you get "second order collision" data? That is data of collisions when a collision is already taking place. The dict.view object displays the first order data first and then subsequent collisions that happen at the same time are listed underneath, how do I get data from these collisions that are listed underneath?

Apologies if I’m not explaining myself too clearly but sometimes it’s hard in Max! :)

Jul 16 2012 | 4:10 pm

hi.
i’m not entirely sure what you are asking.

if a jit.phys.world has collisons enabled, each frame it outputs a dictionary containing sub-dictionaries for every collision currently in the world. it does not matter if the collisions are new or old, the output is the same. the only indication of a collision being "old" is the duration value in that collision’s dictionary.

maybe post a patch showing what you’re trying and what’s not working?


Joe
Jun 25 2013 | 6:45 am

Going back to getting the jit.phys.body position, you mentioned that a getposition message would output the current position to the dumpout. What do you need connected to the dumpout to view the position.

All the best

J

Jun 25 2013 | 11:07 am

hi,
here an example on how to get the position of a body :

<code>
-- Pasted Max Patch, click to expand. --

</code>


Joe
Jun 25 2013 | 12:42 pm

You sir are a certified legend. That has solved an issue that has been bugging me for ages!

Cheers!

J

Aug 19 2014 | 11:49 pm

How would I get the positions of constraints in jit.phys.multiple?

Aug 20 2014 | 9:48 am

you can output a 7 plane matrix containing the 3 position and 4 quaternion values of the constraints by enabling phys.multiple @constraint_matrix attribute. the following example patch demonstrates this, as well as the phys.multiple help patch:
Max 6.1/examples/jitter-examples/render/physics/phys.multiple.constraints.maxpat

Aug 20 2014 | 10:35 am

think u forgot to post the patch :). Having troubles deriving that from the help file.

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

Forums > MaxMSP