Pryme8 Posted August 27, 2018 Share Posted August 27, 2018 So I have a scene where I am building the colliers for the scene after the visual meshes are constructed. I have been trying to get this code to work: if(this.assets['Ground-Body-0'].physicsImposter){ this.assets['Ground-Body-0'].physicsImposter.dispose() } this.assets['Ground-Body-0'].scaling.z = (Math.ceil(level/5)+1)*this.scale*12 this.assets['Ground-Body-0'].position.z = Math.ceil(level/5)*12 this.assets['Ground-Body-0'].renderingGroupId = 2 var wallColliders = [] wallColliders.push(this.assets['Ground-Body-0'].clone('Wall-Body-0')) wallColliders[0].position.x = -this.scale*6 wallColliders[0].setPivotPoint(new BABYLON.Vector3(this.scale*3, 0, 0)) wallColliders[0].rotation.z = -Math.PI*0.2 wallColliders.push(this.assets['Ground-Body-0'].clone('Wall-Body-1')) wallColliders[1].position.x = this.scale*6 wallColliders[1].setPivotPoint(new BABYLON.Vector3(-this.scale*3, 0, 0)) wallColliders[1].rotation.z = Math.PI*0.2 this.assets['Ground-Body-0'].physicsImposter = new BABYLON.PhysicsImpostor(this.assets['Ground-Body-0'], BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.3 }, this.scene) //wallColliders[0].physicsImposter = //new BABYLON.PhysicsImpostor(wallColliders[0], BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.3 }, this.scene) //wallColliders[1].physicsImposter = //new BABYLON.PhysicsImpostor(wallColliders[1], BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.3 }, this.scene) What I am noticing, is when I add the physics imposter to the "wall" it disappears. Alternatively if I create the imposter first and then clone the "ground" mesh, I get the same results of the walls disappearing. Ive tried making it unique geometry, backing the transform etc... and am kinda stumped. Pretty sure its linked to the set PivotPoint, but I was just wondering if anyone had any input on to what would cause behavior like this. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 27, 2018 Share Posted August 27, 2018 Pretty sure it comes from the pivot as well. How does it look like without the lines about pivot? Pinging @RaananW for review if he is around Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 28, 2018 Author Share Posted August 28, 2018 Yup stripping the pivot position fixes it going ghost on me... but I need to be able to rotate by a pivot position so I guess put it into a transform container and manipulate that? Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 28, 2018 Share Posted August 28, 2018 Parenting to a bounding/parent mesh which can act as the collider? Sometimes you overthink these things - I know.... DB GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 10, 2018 Share Posted September 10, 2018 When you miscalculated a position or any of the joint's values (or, well, whenever I make a mistake developing the physcis plugins), there is a chance the physics engine will react rather aggressively and will throw the body "somewhere" in a single frame. If you can reproduce this in the plyground I will be able to help with finding what went wrong Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.