Dad72 Posted December 30, 2017 Share Posted December 30, 2017 When I put my model back on a smaller scale, the impostor no longer corresponds to the mesh. If I do not resize it, it works fine, but after rescaling, something is wrong. http://www.babylonjs-playground.com/#GA8XI#88 (If the template does not display, refresh the browser (F5) and this is displayed.) Thanks Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 31, 2017 Share Posted December 31, 2017 Hi D72, how ya been? I hope well. I can't get that PG to load... FF or IE. Looks like security problem. Direct browse of http://www.babylon.actifgames.com/anim/walk.babylon works. Many times I refreshed/reloaded, +cleared cache... no success. Ideas? FF console reports "failed to load [domain] walk.babylon". IE reports "Access Denied" but no URL reported. Maybe only problem for me. Anyone else having failed .babylon load-in on that URL? (thx) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted December 31, 2017 Author Share Posted December 31, 2017 Yes I'm fine Wingnut, thanks. I hope you too ? It works well at home on google chrome. You have to refresh a second time sometimes to make it work. I do not really know why. I add an image to show what it gives. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 31, 2017 Share Posted December 31, 2017 Thx, Dad72, I am well. Okay, so, problem is with bounding box size... after scaling, correct? You could remove all physics, and problem can still be seen with ONLY showBoundingBox? SO, boundingBox size problem, and perhaps NOT physics impostor size problem? I think boundingBox size is based-upon first frame of animation. https://www.babylonjs-playground.com/#1LNWLE#3 No matter what animation does, bounding box remains the same size/orientation. Impostor likely same. So, perhaps physicsImpostor cannot change size or orientation... on each frame of animation. In the picture, are we viewing first frame of character animation? Or, later frame? Adam once showed us how to set ANY boundingBox size. https://www.babylonjs-playground.com/#BFM7EX (line 26) You COULD enlarge bounding box a small amount... before adding impostor. *shrug* When you change scale, then you could test character.getBoundingInfo().boundingBox.extendSize... check if it scaled proper amount. I don't know if I am helpful. Could be bug, too. Sorry if I am interrupting. Wingnut thinking about issue. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted December 31, 2017 Author Share Posted December 31, 2017 The thing is, I did not have this problem in previous development with the physic. The object falls back to the ground. But not anymore after resizing the object. If I do not resize it, there is no problem, so I think there is a bug, it's not normal. The boundingbox was to see the size of the object, but I can do without it, the problem is not there. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 2, 2018 Author Share Posted January 2, 2018 @Wingnut If I delete physics as you suggest, I do not see the bug, the object is on the ground. But as soon as I put the physics, the object goes up and floats when it is rescaled. If I do not scale, it works fine, so I think there is a bug after rescaling. with Oimo and Cannon I think it's because there are bones, a bone-free object, works even if it's resize. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 2, 2018 Share Posted January 2, 2018 Interesting! Thx for info/pic. hmm. https://github.com/BabylonJS/Babylon.js/blob/master/src/Physics/babylon.physicsImpostor.ts#L181 See that? .setScalingUpdated(bool) Possibly, impostors cannot scale, ever. So, forceUpdate() is needed... after any shape scaling... to install a NEW impostor... via calling init() in line 190. Try it, if you please. See what happens. Maybe explosion, maybe solution. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 2, 2018 Author Share Posted January 2, 2018 No, the problem is always present. http://www.babylonjs-playground.com/#GA8XI#89 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 2, 2018 Author Share Posted January 2, 2018 Here using the Dube available on Babylon, the physics does not work at all, the dude falls through the ground. I try the rabbit too, and the physics does not apply at all as if I do not add any. As soon as there are bones, physics has problems. I specify that in previous versions using the same model that I had it worked properly, so there is a bug that seems random from one model to another that contains bones Here the Dude falls through the ground. http://www.babylonjs-playground.com/#GA8XI#91 Here my character floats in the air if he is put back on the scale : http://www.babylonjs-playground.com/#GA8XI#89 Here the rabbit does not get any physics apply https://www.babylonjs-playground.com/#1LNWLE#17 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 3, 2018 Share Posted January 3, 2018 The physics engine doesn't handle new scaling of objects. This is also written in the documentation - any physics engine (at least the ones we currently have) are based on rigid, unchanged bodies. Scaling changes the properties of the body, and requires a new impostor. You did set the scaling-updated to be true, which should recalculate the impostor (and it does). I need to see why the box doesn't scale correctly. Regarding the rabbit and the dude - if you checked what meshes[0] actually is, you would find out that both those models are built using many meshes, and that the first one is just a null-parent which has no vertex data. So, the dude won't work the way you wanted it to. you will need to set an impostor to each of the child meshes. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 3, 2018 Author Share Posted January 3, 2018 Ok, thanks for the clarification Raanan. I did not know how the Dude and the rabbit were built. I do not use physics often, so I dont know very well how it works. I do not see anything in the documentation of the physics which speaks about the resizing (scale) after knowing reread the 3 available. thanks check why the impostor (bounding box) is not correct. By cons what I do not understand, I already use this model with the physic and it worked after resizing (to version 2.5 it seems to me) When I use a mesh without bones, even resize it works, but if there are bones, it does not work properly after resizing. Yet if I display the bones, it is correctly resize. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 3, 2018 Share Posted January 3, 2018 So there might be an issue with bones and physics. I will see if I can make it work. Note that bones are not supported in the physics engine. if a mesh is animated, it doesn't mean the impostor will change (it will stay the same size, and with the same transformation). Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 3, 2018 Author Share Posted January 3, 2018 Yes no worries, I use physics just to adjust my objects perfectly on the ground when I add them with my editor. Then I do not use physics anymore. I know I can do it differently, but physics simplifies this step because even if I move my object with a gizmo, it stays on the ground with physics. But bone objects do not seem to work properly anymore. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 3, 2018 Author Share Posted January 3, 2018 I just had the same problem at the moment with another object that has no bone. This is a house that I already use before and that worked well even after being scaled up. But he now finds elevating like the character. So it's not a question of bone. something to change since. I have the impression that the pivot point is not properly modified after being rescaled. Without rescaling we can see the pivot in the center of the object : *** And with scaling back the pivot is no longer in the center : *** Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 3, 2018 Share Posted January 3, 2018 Can you share the scaling code you used? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 3, 2018 Author Share Posted January 3, 2018 Yes, I use this function : addMesh(root, file, type, scaling = 1.0, shadow = true) { BABYLON.SceneLoader.ImportMesh("", root, file, global.scene, (newMeshes, particleSystems, skeletons) => { let mesh = newMeshes[0]; mesh.rotationQuaternion = null; if(type == "character" && skeletons[0]) { let skeleton = skeletons[0]; mesh.updatePoseMatrix(BABYLON.Matrix.Identity()); } mesh.layerMask = 3; if(shadow) this.addShadow(mesh); mesh.isPickable = true; mesh.metadata = {"type": type}; mesh.scaling = new BABYLON.Vector3(parseFloat(scaling), parseFloat(scaling), parseFloat(scaling)); mesh.position = global.editor.cameraUser.getFrontPosition(10); mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.BoxImpostor, { mass: 1.0, friction: 0, restitution: 0, nativeOptions: { collisionFilterGroup : 2, collisionFilterMask: 1 }}, global.scene); this.UI.windowClose(); }); } I can send you the model by MP if you need it too. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 3, 2018 Share Posted January 3, 2018 can you try without physics and bones? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 3, 2018 Author Share Posted January 3, 2018 Without the physics on the house, the pivot point is shifted again after being scaled back. Same thing for the character without the bones. On the other hand, on the character, the pivot point is always in the same place. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 3, 2018 Share Posted January 3, 2018 Pinging @RaananW to check if this could be related to physics Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 3, 2018 Author Share Posted January 3, 2018 What is strange is that even without the physics, the house have their pivot to move lower after the smaller resize. But without resizing its pivot is at the center of the object. (see the two pictures houses) Maybe it's another problem besides physics where the object does not descend to the ground. I know this model worked 1 year ago, but not anymore. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 5, 2018 Author Share Posted January 5, 2018 I fixed the problem of the pivot, it was my fault, sorry. So I try again to re-export my object and load with physics, the object floats at the same height as the character. The object has its pivot to replace its center, this problem is correct, but the object it does not fall to the ground. Both objects float at the same height, I do not think this is a coincidence, my two object is exported with 3ds max. I think that all my export objects will have this object problem floating at the same height. If I use primitives (box sphere ...) it works normally. Would not it be a random inversion to what should be the top and the bottom, I'm looking for a track idea. But I have the impression that what is export blender will work but not 3ds max, but this is only a hypothesis. I will try another object export with 3ds max. PG wihtout bones: (use http if you do not see the object) http://www.babylonjs-playground.com/#GA8XI#93 For the character I add a sphere parent to see where is its pivot point, it is also at his feet. But he also floats with physics. PG with bones: (use http if you do not see the object) http://www.babylonjs-playground.com/#GA8XI#94 It's not a question of bone, because I have a PG without the use of bone and another with the use of bone. The pivot point is ok, but the two object does not fall. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 5, 2018 Author Share Posted January 5, 2018 I confirm that everything that is export with 3ds max, does not work with physics. In this pg I made a simple primitive box with 3ds max, I export it and load and it also floats at the same height. (whatever the rescaling) (use http for see object) http://www.babylonjs-playground.com/#GA8XI#95 I add the object box made with 3ds max and export with also in a zip file attached box3dsmax.rar Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 5, 2018 Share Posted January 5, 2018 Issue was created (https://github.com/BabylonJS/Babylon.js/issues/3489), I will look into it. Issue was created before I updated the page. So, is there an error, or is it only on your/3ds' side? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 5, 2018 Author Share Posted January 5, 2018 @RaananW No, there is no problem with 3ds max, and the mistake is when I load the babylon scene with physics. I made a mistake on the pivot that is correct, but the object does not fall to the ground on any object that I export with 3ds max (version 2017). You can reopen the problem, but with a different title I think. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 5, 2018 Share Posted January 5, 2018 reopened, I will look into it. 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.