-1

So apparently the cocos2d community thinks I'm a spammer because I don't understand their tutorials, so here I am :D

Hey I'm just trying to get physics working with a single object but get "failed to find a parent ccphysicsNode for this ccphysicsbody. The ccphysicsbody requies it be the child of a ccphysicsnode when onenter is called".

in my init function for the scene i have,

override init(){
super.init()
let scenePhysics = CCPhysicsBody()
self.physicsBody = scenePhysics
}

I was unable to find a proper tutorial, or an answer after a lot of googling. It seems the api docs tells you what to do but not how to do it. I see examples setting physics world, then i see cocos2d api not have a physics world, or not saying you need one. Conflicting things, no hard answer or example how to do this.

-already tried reading docs -added CCPhysicsContactDelegate to class definition -read http://cocos2d.spritebuilder.com/docs/api/Classes/CCPhysicsNode.html -tried adding physics node to scene in spritebuilder

shwick
  • 4,277
  • 6
  • 21
  • 28

1 Answers1

0

I was adding CCPhysicsBody instead of CCPhysicsNode

shwick
  • 4,277
  • 6
  • 21
  • 28