omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    SpriteKit problem

    Pythonista
    2
    3
    2413
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • smartvipere75
      smartvipere75 last edited by

      Hello, I am opening this topic once again since I still didn't get solution. Basically i’m trying to set contactDelegate on physicsWorld of SKScene that’s created through create_objc_class but it doesn’t work. Any ideas? Thanks in advance.

      Here is full code:
      https://gist.github.com/anonymous/2530353b2a41c19746bf9c0e0fa9a57f

      Note:
      The code is basically modified version of this:
      https://github.com/jbking/pythonista-misc/blob/master/spritekit/skview-demo.py

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        node.physicsBody().contactTestBitMask=1

        in two places (end of your shape creation functions) solves the issue.

        contactTestBitMask is mentioned in the description of https://developer.apple.com/documentation/spritekit/skphysicscontactdelegate , and looking at the description shows that it is a way of only responding to contacts that you care about.

        smartvipere75 1 Reply Last reply Reply Quote 0
        • smartvipere75
          smartvipere75 @JonB last edited by

          @JonB said:

          node.physicsBody().contactTestBitMask=1

          in two places (end of your shape creation functions) solves the issue.

          contactTestBitMask is mentioned in the description of https://developer.apple.com/documentation/spritekit/skphysicscontactdelegate , and looking at the description shows that it is a way of only responding to contacts that you care about.

          Thank you so much for your help! I highly appreciate it, and it’s that situation when code wasn’t working because of simple mistake.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors