Knight Posted June 1, 2017 Share Posted June 1, 2017 I have a mesh imported from .babylon file, and it has its animations. I put MeshImpostor in, expecting it to update with the animation, but it's not. It seems like it uses the first frame as the reference to the collision detection. Is there any way to update it? Code is something like this: var mesh = scene.meshes[0]; mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.MeshImpostor); //I tried to force it update it too, but doesn't seem to work. function update() { mesh.physicsImpostor.forceUpdate(); } Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 1, 2017 Share Posted June 1, 2017 Physics objects don't participate in animations like regular meshes. You may need to .sleep() your mesh.physicsImpostor and then .wakeUp() after. The wakeUp() will activate again the physics. If you want to move a physics object and keep the physics impostor properties then you need to apply impulses. Creating a PG might help. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Knight Posted June 1, 2017 Author Share Posted June 1, 2017 1 hour ago, brianzinn said: Creating a PG might help. PG is babylon playgrounds, right? Is there any way to upload the mesh there? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 1, 2017 Share Posted June 1, 2017 I think only certain sites work because of CORS. Hopefully somebody else will chime in - I've never tried. Is it not reproducible with regular meshes? Quote Link to comment Share on other sites More sharing options...
Knight Posted June 2, 2017 Author Share Posted June 2, 2017 It has something to do with mesh and bone movement in the animation, and I don't know any example that has bone and mesh animation. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 4, 2017 Share Posted June 4, 2017 Hi guys! Forum friend @Raggar did a little playground work with rag dolls. (press A key). I think RAG dolls is how RAGgar got his name. And of course... there is Sammy Girardin's ragdolls extraordinaire... but his site is now "down". But before it went away, I grabbed zips of his ragdoll and crowd-pathing [crowd.zip] demos. Here's the ragdoll demo: http://urbanproductions.com/wingy/babylon/oldman/Oldman_onefile/onefile01.htm Does that work for anyone but me? I hope so. Zip available. Sam gave me permission to republish, so there's no problems there, but PLEASE give Sam some credit if anyone uses his code/techniques. His ragdolls use an older version of BJS, and all typescript files are included in zip. It is NOT easy code for average people. And, my onefile version has SOME minor issues (skybox lighting?), but no show-stoppers. I like choosing x30, and then, after "the fall", click F button to the beat of ANY song. FUN! Shoot the Geeks FAR-into the air, and when they land, they get stuck in the ground. THEN click F to the beat of a song. TOO funny! I ALMOST HAD-TO make a Fraps music video... from that. Thank goodness I was too lazy. I think the version that is included on the BJS website... is broken. I don't know if it is wise or right to re-target the BJS website link... to my onefile01.htm. We should probably talk to Sam, first. I hope he's okay. He hasn't visited in quite a while, and we haven't heard much news on his new EnergyJS physics engine... for a long time. Usually, when a guy "goes missing" like this, it means he got a girlfriend. That POOR POOR man. We might need to assemble a rescue team. Perhaps we should use the dude.babylon armature-animation available in many PG (playground) demos, and try to "attach" a couple of boxImpostors to his feet, and see if we can kick a sphereImpostor. See if we can make the impostors on each of dude's feet... move/track WITH his feet bones. Beginner-level ragdoll testing. Thoughts, anyone? Bones are not really mesh, they are 'transformations', so we can't attach one end of a physicsJoint to them (with other end on foot boxImpostors). We must attach the joints onto the skin-mesh... near the ankle, I suppose. I'm not very experienced, but forum friend @fenomas tells us that it is best to use a physicsJoint between the force-moved mesh, and the physicsImpostor that is trying to be moved ALONG-WITH the moved mesh. The physics joint serves as an "insulator" between the force-moved mesh, and the come-along impostors. The physics engine is able to stay in-sync with its impostors... BETTER... this way... I hear. I haven't experimented with that, yet. The theory makes sense, though, and has likely been used by many other physics experimenters. Sidenote: The "spring" feature of physics joints is an often-forgotten way to START physics animations, too. Springs (and physics 'motors') "launch" physics things... quite well. Catapults/Slingshots, 101. heh Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 4, 2017 Share Posted June 4, 2017 Hey, @AndyBeaulieu just visited the forum again! Hi Andy... good to see you! Andy holds a place in our Offsite Tutorials List, and guess what. Andy did some very early experiments with rag dolls and other physics stuff. He has kicked some balls! http://www.spritehand.com/2014/08/babylonjs-physics-and-character.html Sure, he's got a stale link to our BJS docs, but we can overlook that, I suspect. Perhaps he will have a moment to comment. Also, Andy, feel free to edit the Offsite Tutorials List in any way you wish. I hope you have been well. Quote Link to comment Share on other sites More sharing options...
adam Posted June 4, 2017 Share Posted June 4, 2017 I would do something like this: http://www.babylonjs-playground.com/#RJRPPN http://www.babylonjs-playground.com/#RJRPPN#1 edit: this isn't the thread I thought it was. I thought it was the one about clicking an animated model. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
Knight Posted June 5, 2017 Author Share Posted June 5, 2017 That ragdoll code shows me the idea. I have problem making it rotate along with the bone, but it doesn't matter as I don't need that much precision. Thanks for the help guys! Quote Link to comment Share on other sites More sharing options...
Raggar Posted June 5, 2017 Share Posted June 5, 2017 @Wingnut The other ragdoll examples got better, but not quite what this guy is after. I like the idea of putting impostors on the limbs of the body, though. I have a demo with hitboxes. I wonder what happens if you attach impostors to those. http://i.imgur.com/kicfLPQ.mp4 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 5, 2017 Share Posted June 5, 2017 *nod* Yeah, I'm not sure how ragdolls do their physics. I was just tickled pink that SOMEBODY (you) got ANY kind of ragdoll working... in a playground. But yeah, the initial post didn't mention any skeleton/bone animation. Just animation. I jumped to a conclusion that the impostor needed to track a bone transformation. Yuh yuh yuh. I need to pay more attention. 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.