Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

In this Discussion

CAN Kinect Physics Code Examples

edited May 2014 in Kinect

I've been getting some notifications that the code examples for the CAN Kinect Physics tutorial no longer work. This is because the code formatting plugin was removed and because the code is severely outdated. For future generations, I will post the code examples below. This code is provided as is, since I've stopped supporting this long ago (as I haven't really used the Kinect since writing the tutorial). Perhaps those still interesting in this code, can gather here and if needed, post updated versions of these code example, that run in more recent versions of Processing and relevant libraries. I still get mails about this tutorial regularly and I will be pointing everyone to this thread. Good luck & happy, creative coding! :)

EDIT 30.05.2014

It seems the forum also has problems correctly displaying the code or something else went wrong. Either way I am providing a download link to the original three code examples (file size: 16 KB). Once again, I can and will no longer provide any support whatsoever on these code examples as I've stopped using the Kinect two years ago. Of course feel free to share updated code examples via this thread.

LINK TO A ZIP-FILE CONTAINING THE ORIGINAL CODE EXAMPLES:

https://dl.dropboxusercontent.com/u/94122292/CANKinectPhysics.zip

Tagged:

Answers

  • Amnon, This is such a wonderful find! I've been trying to set up your code, using the old version for quite a while. One important thing I've learned is that the function enableScene() (as in line 16) is now enableUser() in the new version of simple-openni. Likewise (in line 32) sceneImage() should go to userImage(). They've gotta get substituted in each example.

    I could use some help though. My Kinect won't kinnect to my kompiuter! It's plugged in, green light blinking, and that dastardly println function in Example 1 runs every time. But I don't know why.

    I'm using Mavericks (OS X 10.9), simple-openni 1.96, and Processing 2.1.1. Any help would be infinitely, totally, gushingly and utterly appreciated.

  • edited April 2014

    Hi, im getting a java.lang.RuntimeException: java.lang.RuntimeException: Vertices of chain shape are too close together error on the third example. I have been messing with it for days and cant seem to find a solution. Any help would be greatly appreciated

  • edited May 2014

    @lettucehead- Were you able to solve the problem?

  • @racmc393 were you ever able to get it sorted out? I'm having the same issue

  • edited May 2014

    Any luck guys? Still catching random blobs form surroundings in the third example.. The problem is basically coming from the polygonBlob class. This is what I am trying right now: http://studio.sketchpad.cc/ra7zG2hFWd?clonePadId=ro.SG9ruRMd-X4&cloneRevNum=47

  • Hi I have the same problem and I haven't been able to sorte it out.

    @modqhx I've trayed to run your sketch but I have the following error: The package Toxic.processing does not exist... and also for the pbox 2d ALTHOUGHT I have already download both of them :( do you know why does it hapens? Thank you !

  • Any luck guys? Here i'm having problens with the pbox2d library.

  • edited July 2014

    I was finally able to update Amnon's code to make it work with Processing 1.5.1 with SimpleOpenNI 1.96. I have been running the code for a long time without getting the "Vertices of chain shape are too close together error". You can download the code here: https://drive.google.com/file/d/0B5Lam2smpe1LRUYwM3U2ODJlc0U/edit?usp=sharing

  • Thanks buddy, I have been trying to get it work for weeks! I just downloaded your file and it works flawlessly in 1.5.1.

  • Works also in 2.2.1

    Thanks Ammon and arindamliveguitar .

    Anybody created custom shapes besides the polgon circles and triangles. I was thinking of creating text shapes and or words but don't know where to start.

  • We'll I figured out some ways to get text particles in.

    Text in shape mode and also via text image texture with a mask.

    Maybe my implementation is wrong but I find text shape more slow in rendering.

  • HI all

    I amalgamated/pushed the code from here to Github. Fork away..

    https://github.com/msp/CANKinectPhysics

    Cheers

  • Hi all,

    I'm using processing 2.2.1and keep getting:

    java.lang.RuntimeException: Framebuffer objects are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help. at processing.opengl.PJOGL$PGLListener.init(PJOGL.java:876) at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:617) at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:639) at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:1272) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1117) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:994) ...

    My graphic card is dated. Does it cause the problem? Appreciate any advice.

  • hello,amnon. i am a multimedia design student, recently on processing, I use the processing2.0. I use your code, but found some problems. Similar to the "No library found for pbox2d Libraries must be installed in a folder named'libraries'inside the'sketchbook' folder. "or" the package "pbox2d" does not exist.you might be missing a library " but I have installed box 2D fo proceesing. I am very confused on this issue. You can solve this problem.tank you so much.

  • Hello Amnon. Your wonderful physics kinect sketch runs well after arindamliveguitar code updates. Works with xbox kinect and also with windows kinect. Despite being a newbie i've been studying your code but there're some things that i still don't understand, for example, what's the purpose of the first circle shapes displayed as a grid? Is it possible to override all this code from: drawString(gap * (i+1), 2, 10);//(where 2 is the only size value i can tweek), and delete or simplify the whole void drawString() section? I'm trying to modify the size of shapes to increase the minimum poly size, as i'm drawing some number ID's on top of the shapes but some of them are too tiny and text is bigger than those tiny polys. Your color palette randomizer is also hard to modify without messing up, as the color values aren't typical hexadecimal, but you warned us about this personal color method. One of my aims to this code mod is to place some text ID on the shapes, randomly picked from a string. The random selected ID should be a new one on each shape created, as each ID will trigger display a specific text (on another screen area) whenever a user's event activates the trigger. Since you created a master shape class that later has two child subclasses for polygons and spheres, i thought to place my code line just where new shapes are added, but every time a shape is created the new random number gets displayed on all existing shapes on screen. I have tried to move the code line to every logical place to get the result i need but seems useless.

            CustomShape shape1 = new CustomShape(-10, 100, -1,BodyType.DYNAMIC) ; 
            CustomShape shape2 = new CustomShape(-10, 250, random(2.5, 20), BodyType.DYNAMIC);
                polygons.add(shape1);
                polygons.add(shape2);
                randNum = random (122);//<<where should i place this line??
                }
    

    The syntax for drawing text(artNum[int(randNum)], 0, 0); gets called inside pushMatrix() of CustomShape void display() to get the same coordinates... Is it possible to assign each float random value generated to new created shapes? can i create a custom class constructor with this extra value that i could call back later on customshape display? Sorry for throwing so many questions, any help or advice would be truly appreciated!

  • Let me iterate once more that I have stopped supporting this a long time ago. I haven't used the Kinect in years, so I don't know what's changed and how to make things work. Also it seems the updated code has incrementally developed.

    @nusonica: The drawString() method is not in my original code, so I don't know. Any changes or additions you want to make (colors, shapes, text, etc.), feel free to do so, but I cannot provide support for this. All I can say is good luck!

  • The shapes aren't falling :(. Also is there a way to customise the shapes? Say like inserting images instead of shapes?

  • edited February 2015

    art is not techne τέχνη = "craftsmanship", "craft",

    this meant to be a criticism (written with full humility) Processing or other sites like this who use the word Open but not as a symbol of openness

    beginners can hardly build something everything is kept very secret behind there a big business or looking for fame alone code is not Art but Techne no one wants to share his results or experience there is not growth but a continuous block who is good at coding may not be capable in art as aesthetic the word art has another meaning= grow together in experience

  • edited September 2016

    I updated @msp's code for the Amnon's Example03_Physics to work with Processing 3 using Shiffman's openKinect library, since SimpleOpenNI and openNI don't work after Processing 2. openKinect lacks user body tracking so it uses depthImage pixel difference instead, kinda surprised it worked. I only tested this with Kinect for xbox 360 v1, model 1473. I'm new to github so maybe I should've forked off msp's git but anyway here it is. This is a great use of Kinect and great work by Amnon so should live on!

  • @eriknau, you should also post your work @ "Share Your Work" category.
    And in order to spread your tweaked code even more, post it @ Reddit too:
    https://www.Reddit.com/r/processing/

  • Hey guys I am using mac and last version of processing, but I cant run even the last version, I have a problem with toxi library can you please help me !

  • Are you trying to use PDE Contribution Manager to install ToxicLibs? It is temporarily disabled as of a week or two ago -- not sure if it is fully Processing 3 compliant. You might want to use Processing 2 and manually install it.

  • Thank you sir !

  • Hey! Trying that awesome Processing 3 example from @eriknau and running into an error. Error is "Cannot find a class type named "PolygonBlob"". Any ideas about how I can move forward beyond this error? Thanks!

  • Yes! @jeremydouglas that's exactly what I'm trying to do. Is the PolygonBlob.pde code to already included in the the physics example? How would I include it? New to all of this so any help would be great!

  • Got it, yes, that code should have been added! Simple mistake. Thanks for your help. Much appreciated. :)

  • @PartyWave -- glad it was helpful and you figured it out!

  • I m using this code for Kinect for xbox one, and I get the msg, that my kinect isn t connected. what should I change in this code to get the connection fixed.

  • Hi folks,

    can anyone help me? I want to use png transparent images instead basic shapes. It's possible? How I can do this? Thanks

  • Yes it is possible. I used .svg files in class void display(){}

  • @ayoub you will have to update your processing files. It has to do something with libraries

  • This updated library of SimpleOpenni work with Processing 3:

      https://github.com/totovr/SimpleOpenni
    

    Also I have some examples here:

      https://github.com/totovr/Processing/tree/Processing-3.3.6/Kinect
    
Sign In or Register to comment.