Wingnut Posted January 17, 2016 Share Posted January 17, 2016 Hi guys. Well, I put the path model (from path_pod_kotom1.babylon... into the playground, but it doesn't look-like the original, nor was it positioned or rotated sanely. But that is a different issue. http://www.babylonjs-playground.com/#3QZYR#3 Apparently the playground is using preview release 2.3. It appears that the model is working fine (other than the model being misshapen in the playground), and no more warnings in the console. yay! So, yes, we were using the wrong BJS and/or CannonJS version (inside the zip). MeshImposter is working fine, it seems. Plotting copied vertexData from .babylon files into playground vertexData plots... that's not so good. But that is the first time I ever tried that, so it is likely a Wingnut problem. Keep us posted, Ian, good luck. And thanks for your help/info, Raanan. RaananW 1 Quote Link to comment Share on other sites More sharing options...
ian Posted January 18, 2016 Author Share Posted January 18, 2016 Ok, I try everything. I try with this version I attach it (babylon.js and cannon.js). I download this two file from https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview%20release. I thing it must be some problem with model path_pod_kotom.babylon. Can anybody test my example to find out what is a problem? Is it problem with blender (import-export: Babylon.js)? I attached in previous post (path_pod_kotom.blend), so you can see model in blender. And you can export it for babylon. Does BABYLON.SceneLoader.ImportMesh work correct? Did I forget anything in code or in blender modeling? I attach captureDesktop.mp4 and example_code.zip (model in blender file and exported babylon file). .In video console shows that I use Babylon v2.3.0-beta . RaananW, Can you please take a look this example and this model. Is possible that there is something wrong with model? greetings captureDesktop.mp4 example_code.zip Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 18, 2016 Share Posted January 18, 2016 Hi Ian, I will look into it. Wingnut's playground might give you a hint as to what the problem is - the object seems a bit transformed, I am not sure if it is done in the .babylon file or somewhere else. I might have the time later this evening, will check it out. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 18, 2016 Share Posted January 18, 2016 I think your isse arrises because of the negative scaling that you use ("scaling":[-1,-0.0727,-1] in the .babylon file). can you try with positive scaling and update us? I am anyhow still debugging this. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 18, 2016 Share Posted January 18, 2016 This is Wingnut's demo with different rotation - http://www.babylonjs-playground.com/#3QZYR#4 . is that what you wanted to achieve? Quote Link to comment Share on other sites More sharing options...
ian Posted January 19, 2016 Author Share Posted January 19, 2016 Yes this is what I want to achive. But your model is not like it is in blender (see blender's model file). I'll try to find the problem first only plane, and then with another plain coninued under angle. It's look OK. If Iunderstand correctly. I have some problem in model. I made it with blender. Can anybody tell me what is the problem with .blender file or .babylon file (exported from blender). negative scaling I'll check where is negativ scaling. (I negativ scaling by x or y or z or everyon or combination? (mash imposter implementation is OK, fine ) I'll allway check in console that it printout "Babylon.js engine (v2.3.0-beta) launched". OK, I'll try to find out problem in model in .blender and exported .babylon file. Quote Link to comment Share on other sites More sharing options...
ian Posted January 19, 2016 Author Share Posted January 19, 2016 Yes model is a problem. I don't know how it comes to wrong scale-ing. I test with new simple model and mesh impostor works great. RaananW your implementation works great. Great work! RaananW Is sphere's impostor bounding box Cube or Sphere? (There are some space between ground and sphere) If I see right is it Cube. Probably because betther colision calculation? I attach mp4 video. How it works. OK now I'll try some more complex model. So if sphere will fall through then it is problem with model. I think I can conclude this topic. Thenx for your help. greetings example.mp4 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 20, 2016 Share Posted January 20, 2016 http://www.babylonjs-playground.com/#3QZYR#6 No gap, Ian. Sphere impostor uses a CannonJS-based boundingSphere, not a BabylonJS-based boundingBox or boundingSphere. See line 23? The "body" is returned when you call setPhysicsState on a mesh. I named the body... playBallBody. Look at line 24. Console.log says the .boundingRadius is 1.5... which is the correct radius for a sphere sized 3. (I used an object inspector on playBallBody... to find the .boundingRadius property.) I believe the bounding BOX you are seeing in your video... is coming from BabylonJS. I believe BabylonJS mesh bounding boxes are not used for physics engines like Cannon and Oimo. I don't think Cannon or Oimo have a "showBoundingBox" or "showBoundingSphere" for their impostors. http://www.babylonjs-playground.com/#3QZYR#7 (if BJS boundingBox was used for physics, our sphere would be bouncing like a box) And, I've now lost my forum cursor by trying to do a control-c and control-v in Firefox... so I will end here. RaananW 1 Quote Link to comment Share on other sites More sharing options...
ian Posted January 20, 2016 Author Share Posted January 20, 2016 I made more complex mesh (Path) and (Ball). I still have a problem, with mesh impostor and this new model. Ball falls through where it should not. And there is a gap between ball and Path mesh. I attached test project. I include Path.blender and Path.babylon files. Can anybody test this and find the problem? Does babylon exporter have any bug? What is wrong? You can rotate model (Path) with key 1,2 3,4 5,6. Please help. greetings TestProj.zip Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 21, 2016 Share Posted January 21, 2016 Hi Ian, I'll look into that. Let's see what's the problem. For future reference, and it's not out of laziness (or maybe it is!) - would it be possible to have something online instead of a zip file? Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 21, 2016 Share Posted January 21, 2016 Ok, found the problem. The MeshImpostor is not taking the mesh's transformation into account. To fix this, simply call perplexus.bakeCurrentTransformIntoVertices(); before setting the physics impostor. This will "reset" the mesh'S transformation, and the path will work. I will check how to get it to work, but this is a wonderful solution in the meantime. Attached - a happy animated gif. Quote Link to comment Share on other sites More sharing options...
ian Posted January 24, 2016 Author Share Posted January 24, 2016 OK, RaananW. (all code is same as above, when I attach zip file) I add perplexus.bakeCurrentTransformIntoVertices(); before perplexus.setPhysicsState(BABYLON.PhysicsEngine.MeshImpostor, { mass: 0, restitution: 0 }); 1.) SCENARIO 1 change code (scale playball) playBall.scaling.x = 2; playBall.scaling.y = 2; playBall.scaling.z = 2;(and postion it on) playBall.position.x = 0; playBall.position.y = 5; When playBall falls on path itself starts rolling on the left side of path edge, but playBall falls through left side of path before it colides path's left side edge. PlayBall should coledes path's left side edge and stops there or deducts. Here are no differences if I add perplexus.bakeCurrentTransformIntoVertices(); or not. (attached video how it looks like - Scenario 1 starting .) 2.) SCENARIO 2 (this looks pretty ok, somtimes are problems, somtimes fall falls through path) playBall.position.x = 0; playBall.position.y = 30; playBall.position.z = -20; It looks fine. Because I rotate Path, somtimes Ball falls throught path. I can rotate path with key 5 or key 6 --------------------------------------------------------------------------------- I would like to put example on babylonjs-playground. But I don't know it it is possible to add .babylon file on babylonjs-playground.com??? Is it possible to upload .babylon file to www.babalyonjs-playground.com server and load it from it (http://www.babylonjs-playground.com/scenes") like for my example ( Import Meshes - example load skull.babylon ) BABYLON.SceneLoader.ImportMesh("", "scenes/", "skull.babylon", scene, function (newMeshes) BABYLON.SceneLoader.ImportMesh("", "scenes/", "Path.babylon", scene, function (newMeshes) I don't have permission to upload my model in directory "http://www.babylonjs-playground.com/scenes/" Kazam_screencast_00000.mp4 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 25, 2016 Share Posted January 25, 2016 Oh, look at that sphere drop... I will try checking what's wrong with it. The spheres i added worked wonderfully. Have you tried adding a sphere using Babylon's internal functions? (Or as a geometry in the .babylon file). I doubt there will be any change, but worth a try. Does it happen in any other position? I tried the big slide at the back. Adding an external .babylon file will only be possible if you allow CORS on the remote server. You could also follow Wingnut's demo here - http://www.babylonjs-playground.com/#3QZYR#7 , he just pasted the vertex-data of both normals and positions, which is a wonderful idea. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 25, 2016 Share Posted January 25, 2016 Just an idea btw : we've got a 3D engine, a physic engine, plenty of fun cameras ... anyone had the idea to code an Angry Bird-like 3D game ? Quote Link to comment Share on other sites More sharing options...
ian Posted January 25, 2016 Author Share Posted January 25, 2016 RaananW, I made new model, just first part (which have problem where ball fall through). I have to know you. It's all OK. Mash impostor works OK. I'll make model gradually and test it gradually. (i think that there should be some problem in .babylon file which was exported or I did some mistake in blender when I create model.) Once later I'll show you video how it works OK. I think your mesh impostor work OK. And there are some problems with blender when I modeled model or are there some problem with .babylon exporter. Maybe it would be good to find problem in file .blender or exported .babylon file. I think that I posted .blender and .babylon file inside zip file before. greetings Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 25, 2016 Share Posted January 25, 2016 Hi Ian, All good We are always looking for bugs, so if you find one, please let me know. If you ever find what the problem was with the exporter, it will be very helpful for everyone else as well, to prevent that from happening. Keep us updated! R. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 26, 2016 Share Posted January 26, 2016 Hey Raanan, speaking of pasting parts of .babylon files into playgrounds... check THIS out... http://www.babylonjs-playground.com/#VMFNH#20 Somebody pasted-in the entire .babylon file as a string, and then used the SceneLoader on it! How cool is THAT?! OMG! I love it. RaananW and ian 2 Quote Link to comment Share on other sites More sharing options...
ian Posted January 28, 2016 Author Share Posted January 28, 2016 here is example how well sphere impostor works with mesh impostor. I did not have time to test previous model. I'll try copy/paste as Wingnut suggest. And try to post it on net and add link maby sombady will find the problem with previous model. Kazam_screencast_00000.mp4 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 28, 2016 Share Posted January 28, 2016 Hi Ian, The screencast movie is all grey. At least on my mobile. I really want to see it thou .I can't seem to find the time to debug the old mesh. If I will, I'll keep updated. If anyone else experiences such a behaviour, please let me know! Quote Link to comment Share on other sites More sharing options...
ian Posted February 22, 2016 Author Share Posted February 22, 2016 Hi RaananW Here is some example with your implementation of mesh impostor and sphere impotor. I have to implement rotation around center of sphere. Now is just around center of path. http://ajna4taiga.no-ip.org:8080/BabylonBall/PerplexusProdV1/Main.html greetins Wingnut, RaananW and jerome 3 Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 23, 2016 Share Posted February 23, 2016 Wow! such a wonderful idea! I'm really glad the mesh impostor is working well Once this is finished, please (PLEASE) post this in the demos section. Quote Link to comment Share on other sites More sharing options...
ian Posted February 24, 2016 Author Share Posted February 24, 2016 RaananW, My frinds will help me solve rotation around ball. So that perplexus path will rotate around current ball position. He is trying to make it with parent child aproach. Can you give me any advice or can you give me some code (advice) (with comemnt's how to rotate around ball). I don't understend well getWorldMatrix how to use it to rotate perplexus(mesho) or should I use pivot intstead.. I have to play with fallow camera also. And try to make mobile variante. Where is demo section hosted? I can add it to see people this. How to post to demo section? I'll be very happy I anybody can help me with code rotation around ball center. Or better rotation depended on camera normalization vector. (I have also problem to solve calculation with DeviceOrientationEvent). If anybody can help or advice how to code this, I'll add code to make it better to work on mobile: I like babylon and your mesh impostor works wonderful. greetings Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 24, 2016 Share Posted February 24, 2016 Hi ian, we'll be happy to help, but I don't really get the question Try creating a very simple playground and show me what you tried doing. That'll probably get us all started. About the demo section - it is another section of this forum. When you are done, publish your awesome game there. This will also be a wonderful Submission to the monthly challenge, that ends in a few days Quote Link to comment Share on other sites More sharing options...
ian Posted February 24, 2016 Author Share Posted February 24, 2016 OK, I will prepare playground when I'll have time to prepare it. I'll try to find demo section on forum. Can you give me direct link(s) for demo and "publishing link". Should I publish after I finish rotation perplexus(mesh) arround current ball? Now thera are only rotation around X,Y an Z around center of perplexus(mesh). and A and D around worldMatrix of arc camera (W and D key rotate perplexus around arc camera how it looks at perplexus mesh. There are 2 variante to rotate perplexus. 1. is already around X,Y,Z of center of perplexus(mesh) (key 1,2 3,4 5,6 2. I'll try to solve rotation of perplexus around current center position of ball (maybe keys 1,2 3,4, 5,6 3. variant rotation perplexus mesh around current camera target view with only A and D key for left right rotation and W and S key up and down rotation. Now you can see W and D key for left right rotation of perplexus Depending on the camera's view . With our friend we see some problem with key W and S (which doesn perplexus rotate up and down. W S doesn't work ok A and D work OK. this section of code is not working well // CODE FOR KEY 119=W AND KEY 115=S DOESN'T WORK !!! case 119 : // W -> Rotate forward var cameraMatrix = mainCamera.getWorldMatrix(); var finalAxis = (BABYLON.Vector3.TransformCoordinates(BABYLON.Axis.Y, cameraMatrix)); perplexusRef.perplexus.rotate(finalAxis, (Math.PI / +512) * -1 * rotationSpeed, BABYLON.Space.WORLD); perplexusRef.perplexus.updatePhysicsBodyPosition(); perplexusRef.rotationSpeed = rotationSpeed + 0.1; break; case 115 : // S -> Rotate backward var cameraMatrix = mainCamera.getWorldMatrix(); var finalAxis = (BABYLON.Vector3.TransformCoordinates(BABYLON.Axis.Y, cameraMatrix)); perplexusRef.perplexus.rotate(finalAxis, (Math.PI / +512) * rotationSpeed, BABYLON.Space.WORLD); perplexusRef.perplexus.updatePhysicsBodyPosition(); perplexusRef.rotationSpeed = rotationSpeed + 0.1; break; // THIS SECTION WORK OK case 100 : // D -> Rotate right var cameraMatrix = mainCamera.getWorldMatrix(); var finalAxis = (BABYLON.Vector3.TransformCoordinates(BABYLON.Axis.X, cameraMatrix)); perplexusRef.perplexus.rotate(finalAxis, (Math.PI / +512) * rotationSpeed, BABYLON.Space.WORLD); perplexusRef.perplexus.updatePhysicsBodyPosition(); perplexusRef.rotationSpeed = rotationSpeed + 0.1; break; case 97 : // A -> Rotate left var cameraMatrix = mainCamera.getWorldMatrix(); var finalAxis = (BABYLON.Vector3.TransformCoordinates(BABYLON.Axis.X, cameraMatrix)); perplexusRef.perplexus.rotate(finalAxis, (Math.PI / +512) * -1 * rotationSpeed, BABYLON.Space.WORLD); perplexusRef.perplexus.updatePhysicsBodyPosition(); perplexusRef.rotationSpeed = rotationSpeed + 0.1; break; I'll have to edit complete javascript code to be better than it is now. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 25, 2016 Share Posted February 25, 2016 Hi all! I think Ian is talking about the demos on the BJS web site. Is that correct, Ian? I think Raanan is talking about the "Demos and Projects" section of the forum (a great place to get feedback about your various demo versions). For linking demos on the web site (maybe in third party section)... 1. Make sure your demo is really good, in all ways. This includes testing on many browsers and getting many opinions (maybe gotten via the Demos and Projects forum) 2. Publish/host your demo in a place/way that YOU can control future versions of the demo (+ which version of BabylonJS it uses). 3. It is best if you publish/host at a place where the URL to demo does NOT change. Try to minimize future workload for BabylonJS web-masters. 4. Provide a nice 400px by 250px still-image (jpg?) of the demo, publish that, too. The web-masters will probably copy it to a screenshots folder for the BJS site. 5. Provide a short title for the demo (such as 'Perplexus Demo'), and a "by" credit (such as 'by Ian' or 'by Ian Industries'). 6. Pay the BabylonJS web-master large amounts of money, so he/she can go on undeserved vacations and purchase expensive toys. (just kidding about this, of course) Recap: Nice well-tested demo, you host/publish to firm URL, provide correct-size still pic, devise short title text, devise short credits text, then give all to web-master. I highly-suggest that you take your time and test well. Possibly avoid numeric keypad controls for your demo. *shrug* I hope I haven't said something incorrect. Now, rotating a meshImposter around a moving sphereImposter pivot-point, with rotation direction based-upon current camera angle? I have no idea how to do that. That thought scares me. Sorry. Please create a very basic testing scene in the playground... for maximum assistance. A good start might be Stvsynrj's and Nockawa's "High-Roller" demo. It doesn't work REAL well (sphere sinking/sticking issues, maybe caused-by meshImposter and actual mesh... not staying in 'sync'). It is still pretty good, though. It looks like a nice playground to test (and struggle-with) your issues, and maybe others can help. Be well. 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.