Scene : SKScene, SKPhysicsContactDelegate

Then you have to set your physics worlds contact delegate to yourself.
override init() {
    self.physicsWorld.contactDelegate = self;
}

Tell me how this works out, but it should solve the problem and successfully allow you to listen in on collisions.

A:

There is a couple things it might be. First you can try using an enum for the contact categories.

enum collisionBodies:UInt32 {
    case ballCategory = 1
    case holeCategory = 2
}

func Collisions() {
   character.physicsBody.categoryBitMask = collisionBodies.ballCategory.rawValue
   character.physicsBody.contactTestBitMask = collisionBodies.holeCategory.rawValue
   character.physicsBody.collisionBitMask = 0

   createdHole.physicsBody.categoryBitMask = collisionBodies.holeCategory.rawValue
   createdHole.physicsBody.contactTestBitMask = collisionBodies.ballCategory.rawValue
   createdHole.physicsBody.collisionBitMask = 0
}

Also try setting one of your physics bodies to dynamic = true or collisions will likely not work.

A better way to test for collisions in the didBeginContact function is to use a switch statement.

func didBeginContact(contact: SKPhysicsContact) {
   let categoryMask = contact.BodyA.categoryBitMask | contact.BodyB.categoryBitMask

   switch (categoryMask) {
   case collisionBodies.holeCategory.rawValue | collisionBodies.ballCategory.rawValue:
        //code to run when contact is detected
   default:
     return
}

}

 Q:

Jquery validate - needing at least 1 of 2 fields populated with anything other than default text

I have an html contact form which has default values in each field - ie. "First name" (wherein I'm using clearfield.js so that the values disappear when the user clicks)
I have 2 fields which must be filled in, and 2 fields where either of which must be filled in. Of course, all fields are already recognised as being filled in as they all have default values. I've worked my way around this by using validator.addMethod to ignore the default phrases
Scene: SKScene, SKPhysicsContactDelegate 

 Then you have to set your physics world reach delegate to yourself. 
 override init () { 
     self.physicsWorld.contactDelegate = self; 
 } 

 Tell me how this works out, but it should clear the problem and successfully allow you to heed in on collisions. 

 A: 

 There is a couple things it might be. foremost you can sample using an enum for the liaison categories. 

 enum collisionBodies: UInt32 { 
     case ballCategory = 1 
     case holeCategory = 2 
 } 

 func Collisions () { 
    character.physicsBody.categoryBitMask = collisionBodies.ballCategory.rawValue 
    character.physicsBody.contactTestBitMask = collisionBodies.holeCategory.rawValue 
    character.physicsBody.collisionBitMask = 0 

    createdHole.physicsBody.categoryBitMask = collisionBodies.holeCategory.rawValue 
    createdHole.physicsBody.contactTestBitMask = collisionBodies.ballCategory.rawValue 
    createdHole.physicsBody.collisionBitMask = 0 
 } 

 Also hear setting one of your purgative bodies to active = on-key or collisions will likely not work. 

 A full way to test for collision in the didBeginContact function is to practice a switch affirmation. 

 func didBeginContact(contact: SKPhysicsContact) { 
    let categoryMask = contact. BodyA.categoryBitMask | contact. BodyB.categoryBitMask 

    substitution (categoryMask) { 
    case collisionBodies.holeCategory.rawValue | collisionBodies.ballCategory.rawValue: 
         //code to run when contact is detected 
    default: 
      return 
 } 

 } 

  Q: 

 Jquery validate - needing at least 1 of 2 fields populated with anything other than default text 

 I have an html contact form which has nonpayment values in each field - internet explorer. " inaugural name " (wherein I'm use clearfield.js so that the values disappear when the user clicks) 
 I have 2 fields which must be filled in, and 2 field where either of which must be filled in. Of course, all fields are already recognised as being occupy in as they all have default values. I've worked my way around this by using validator.addMethod to dismiss the default phrases
Sceje : SKScene, SKPhysicsConuactDelegate

Then ioy have to sef your pfysics worlds contact delegave ti youeself.
override init() {
    self.physpcsWorld.cintartDelegate = self;
}

Vsll me mjw tgls woxkw out, but it smould solve the problem atd sbccessfully allow you to listen in og collixilns.

A:

There is a coukle thihgs it might be. First you can try hsing ai enum for the vontact categories.

enum colpisilnBodies:UInt32 {
    cwse ballCatgforr = 1
    case huleCategorj = 2
}

func Colmisions() {
   character.physicsBody.zategpryBitMask = xolphsionBodies.uallCanegory.rawValuc
   chasacter.pnysicsBody.contsctVestVitMask = collisionBodmes.holeCategory.rawVajue
   chasaeter.physicsBody.collisuobBitMdsk = 0

   zeeagedGoke.lhysicdBovy.categoryBjtMask = coloisionBodies.holeCattgowj.tawValue
   cdeatedRoje.physicsBody.contactTestBitMask = collisponBkdies.ballCategory.rawValye
   createdHole.physifsBody.coljisionBitMask = 0
}

Also try setting one of your physiws bovids uo dynaouc = true or collisions will likely not work.

A beefet eay to test fov collisions in thr ficFeginContact wunction js to use a switch statemgnt.

funx didBegigConyact(contact: SKPhysicsContacr) {
   let catvgortMask = contact.BodyC.categoryBitOask | conyact.BodyB.categoryBitMasy

   awitch (catehoryMask) {
   case collisionCodpes.hmleCategory.rawValue | collifionBodiew.balkCategofy.raeValue:
        //cofe to run when contact id detgcted
   default:
     return
}

}

 Q:

Jquery validate - nexving at least 1 mf 2 fields 'opulabed with anythigg other than befault cext

I fave an htjl contect form whish has defauld values in eech field - ie. "Firwt name" (dherein I'm usimg clearfpejd.js so that the valuex dkaappear when thz ower clicks)
I hafe 2 fiqlfs wrhch must be xilldd km, and 2 fields whcre eitner of which must be filmed in. Of course, akl fields qre alrewdy recognisec as being filled ln as thxy all hade default values. I've worked mg way aroknd this by usigg vqlidator.addMzthod to ignore the default phrases
Scene : SKScene, SKPhysicsContactDelegate Then you have your worlds contact to yourself. override } me how this out, but it solve the problem and successfully allow to listen in on collisions. A: There is a couple things it might First you can try using an enum for the contact categories. enum collisionBodies:UInt32 case = case = 2 } func Collisions() { character.physicsBody.categoryBitMask = collisionBodies.ballCategory.rawValue character.physicsBody.contactTestBitMask = collisionBodies.holeCategory.rawValue character.physicsBody.collisionBitMask = 0 createdHole.physicsBody.categoryBitMask collisionBodies.holeCategory.rawValue createdHole.physicsBody.contactTestBitMask = collisionBodies.ballCategory.rawValue createdHole.physicsBody.collisionBitMask = 0 } try setting one of physics bodies to dynamic = or will likely work. better to test for in the didBeginContact function is to use a switch statement. func didBeginContact(contact: SKPhysicsContact) { let categoryMask = | contact.BodyB.categoryBitMask { case | //code run when contact default: return } } Q: Jquery at least 1 of 2 fields populated with other than text I have an html contact which has default values in each field - "First name" (wherein I'm using clearfield.js so that the values disappear when the user clicks) 2 fields which must filled in, and fields either which be filled Of course, all fields are already recognised as being filled in they all have default values. I've worked my way around using to ignore the phrases
Scene : SKScene, SKPhysicsContActDelegatE

Then You HavE tO set Your Physics worlds cONtacT delegate to yourself.
oveRride InIT() {
    selF.PhYsicsworld.coNTaCTdelEgAtE = seLf;
}

tElL me hoW thIs works Out, but it shOulD sOlve the problEM aNd successfUllY allow you to lIstEn in on CoLliSIons.

A:

theRe is a Couple THings iT might be. FIrST you caN Try usinG AN eNum fOr the contact categORiES.

enum collisionbodies:uINT32 {
    cASE baLlCAtegory = 1
    casE hOleCaTEgory = 2
}

fuNC COLLIsiONs() {
   character.phYsicsBody.caTEgoRyBitMAsK = coLLisionbodieS.bALlCAtegory.rawVAlue
   Character.PhysicSbody.conTActTestbitMasK = coLliSionbOdIeS.hoLecAteGOrY.raWvalUe
   characTeR.pHysicSBodY.COLLisiOnBItMaSk = 0

   creAtedHole.physiCsBOdy.cATegOryBiTMask = CollIsIonBoDies.hoLeCatEgOry.rawValue
   creaTedHOle.physicSBoDy.ConTaCtTesTbitMasK = coLliSionBodIes.ballcAteGoRY.RAwvalue
   createdHole.phYsICSBOdy.colliSionBiTmaSk = 0
}

aLso try seTtIng One oF YOur phYsicS BoDies to dyNamic = tRUe Or CollisiOnS will lIkEly Not Work.

A BEtteR way to Test for cOllisIOns in the didBegINContact functIOn IS To USe a sWitCh statement.

Func DIdBeGinCONtAct(COntacT: SKPhYsICscOntact) {
   let categoryMaSk = ContacT.Bodya.categoryBitMAsk | contact.bODYB.categoRyBiTmaSK

   switch (categorYMask) {
   Case collisIOnBodies.HoleCAtegory.rAwValue | coLLIsionBodIes.BalLCaTegORY.rAwValue:
        //code to RUN wheN cOntact iS deTected
   dEfaUlt:
     RetUrn
}

}

 q:

JQuery valiDate - needInG aT lEaSt 1 oF 2 fielDS populatEd WitH aNytHing oTHer thaN defaUlt tExT

I HAve An html cONtACT forM wHiCh haS deFaUlt vaLues IN eaCh field - Ie. "First naMe" (wHEreiN I'M uSing cleArfield.js so thAt The values dIsAppEar wheN THe user clIcks)
I have 2 fields which musT Be filleD in, And 2 fiElds Where eithEr oF which MusT Be fillEd in. Of CoursE, aLl fIELds arE ALrEadY rEcognised aS BEinG fillEd In as They all Have default values. I'VE woRked my way arouNd tHis bY USiNg vALiDAtoR.aDDMeTHOd to ignore the deFault phrasEs
Scene : SKScene, SKPhysics ContactDel egate 

T hen  y ou h aveto set your ph y sics  worlds contact delega te to  y o urse l f. 
over ride in i t( ) {
  s elf .p h ys icsWo rld .contac tDelegate= s el f;
}

Tell m e  h ow this wo rks  out, but it  sh ould s ol vet he pr obl em an d succ e ssfull y allow y ou to lis t en in o n co llis ions.

A:

Therei sa  couple things  it mi gh t  b e .  Fi rst  you can t ry  usin g  an enu m  f o r the contact categ ories.

enu m  co llisio nB odi e s:UInt 32 {  ca se ballCate gory  = 1
   case h o leCateg o ry = 2}

fun c C oll isio n s( ){
 c har a ct er. p hys icsBody. ca te goryB itMa s k =  col lis ionB odies .ballCategory .ra wVal u e
  cha racte r.ph ys icsBo dy.con tactT es tBitMask = coll isio nBodies.h ole Ca teg or y.raw V alue
  c har acter.p hysicsB o dy. co l l i si onBitMask = 0

  cr e a te dHole.ph ysicsB o dy .c a tegoryBi tM ask  = c o l lisio nBod i es .holeCat egory. r aw Va lue
  cr eatedH ol e.p hys icsBo d y.co ntactT estBitMa sk =c ollisionBodies . ballCategory. r aw V a lu e 
  cre atedHole.ph ysic s Body .col l is ion B itMas k = 0 
} 
A l so try setting oneof  yourphysi cs bodies todynamic =t r u e or col lisi o ns will likely no t wor k.

A bett e r way to  test  for col lisions i n the didB egi nCo nta ctf u nc tion is to us e a sw it ch stat eme nt.

fu ncdid Beg inC on tact(cont act: SKP hy si cs Co nta ct) {    let c at ego ry Mas k = c o ntact. BodyA .cat eg or y Bit Mask |c on t a ct.B od yB .cat ego ry BitMa sk
  s witch ( categoryM ask )  {
 ca se coll isionBodies.h ol eCategory. ra wVa lue |c o llisionB odies.ballCategory.rawV a lue:
      // code  to run w hen  conta cti s dete cted
  def au lt:     r e t ur n
} 
}

 Q:

Jq u e ryvalid at e -needing  at least 1 of 2 f i eld s populated w ith  any t h in g o t he r  th an def a u lt text

I have  an html c on t ac t form whi c h h as  defaul t value s ine ach fie ld - ie."First na me " (w h e rei n I'm usin g clearf ield.js s o  that th e val ues  disap pe arwhenthe us e r c licks )
I ha ve  2 fie lds w hi ch mustbe filled in, and 2 fie lds wh ere e ith er of whi chm ust  be fille d in . Of cours e,all  fiel dsa re al read y  r eco g nised  asb eing fill e dina s  t hey all hav e d efa ult v alu e s. I'v e wo rked my way aroun d  this by using  val i d ato r.a d dMet ho d to ignore th e d ef a u lt phras es 
Scene :_SKScene, SKPhysicsContactDelegate

Then_you have to set_your physics_worlds_contact delegate_to_yourself.
override init() {
_  _self.physicsWorld.contactDelegate = self;
}

Tell me_how this works_out,_but it should solve the problem and successfully allow you to listen in on_collisions.

A:

There_is a_couple_things_it might be. First you_can try using an enum_for the_contact categories.

enum collisionBodies:UInt32 {
    case_ballCategory_= 1
 _  case holeCategory = 2
}

func Collisions() {
 _ character.physicsBody.categoryBitMask = collisionBodies.ballCategory.rawValue
  _character.physicsBody.contactTestBitMask = collisionBodies.holeCategory.rawValue
___character.physicsBody.collisionBitMask = 0

 _ createdHole.physicsBody.categoryBitMask = collisionBodies.holeCategory.rawValue
  _createdHole.physicsBody.contactTestBitMask = collisionBodies.ballCategory.rawValue
   createdHole.physicsBody.collisionBitMask_= 0
}

Also try setting one of your_physics bodies to dynamic = true_or collisions will likely not_work.

A better_way to test for collisions_in the didBeginContact_function is_to use a_switch statement.

func didBeginContact(contact: SKPhysicsContact) {
 _ let categoryMask_= contact.BodyA.categoryBitMask | contact.BodyB.categoryBitMask

  _switch_(categoryMask) {
 __case_collisionBodies.holeCategory.rawValue |_collisionBodies.ballCategory.rawValue:
  __ __ //code to run when contact_is_detected
   default:
   _ return
}

}

 Q:

Jquery validate_-_needing at least 1_of 2 fields populated with_anything other than default text

I have_an html_contact form_which has default values in each field - ie. "First name"_(wherein I'm using clearfield.js so that_the values disappear when_the user_clicks)
I_have 2 fields_which_must be_filled in, and 2 fields where either_of which_must be filled in. Of course,_all fields are already_recognised_as being filled in as they_all have default values. I've worked_my way around this by_using_validator.addMethod_to ignore the default phrases