Facebook
From Ronalds Mazitis, 1 Year ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 125
  1. const refresh = () => {
  2.         if(step == userid[step]){
  3.                                                         if(userskin[step] == skins[step]){
  4.  
  5.             that.body.setCollisionFlags(2)
  6.             // set the new position
  7.             that.position.set(-1, -2.41, 0)
  8.             that.body.needUpdate = true
  9.  
  10.             // this will run only on the next update if body.needUpdate = true
  11.            that.body.once.update(() => {
  12.               // set body back to dynamic
  13.               that.body.setCollisionFlags(0)
  14.               // if you do not reset the velocity and angularVelocity, the object will keep it
  15.              that.body.setVelocity(0, 0, 0)
  16.               that.body.setAngularVelocity(0, 0, 0)
  17.             })
  18.  
  19.         }
  20. }
  21.