SuperPudding Posted May 28, 2016 Author Share Posted May 28, 2016 @Steffen I did try using the links directly from the playground and I got the same problem. The run-time error is now not in my script file but in the babylon.js file itself. I wrote about in a previous comment: On 27.5.2016 at 3:09 PM, SuperPudding said: I tried changing the "scene.getPhysicsEngine().sleepBody(impostor)" to "impostor.sleep()". The run-time error in this line did not happen this time, but there was an error later on in the babylon.js file itself. The exception stated "cannot read property 'sleep' of udefined at t.sleepBody" At that point I got stuck, I've dealt with errors on my script before but I have never gotten an error form the babylon.js file. I just don't know what exactly is undefined and where is the problem... By the way the result of "alert(b)" is 'Object object', but other than knowing it's not null or undefined it doesn't help me much. I put it in its own variable mostly for inspecting it using the new debugging methods I learned here (with the browser inspect options). Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 29, 2016 Share Posted May 29, 2016 Can you share your page on a server where we can see it? It is hard to help you without an example Quote Link to comment Share on other sites More sharing options...
SuperPudding Posted May 29, 2016 Author Share Posted May 29, 2016 @Deltakosh How can I share it? can I attach aspx files here? If not, where should I share it? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 29, 2016 Share Posted May 29, 2016 Just publish you site on a webserver so we can see it Quote Link to comment Share on other sites More sharing options...
SuperPudding Posted June 11, 2016 Author Share Posted June 11, 2016 Hello again! I haven't had much time lately to work on this (had lots of exams, I'm finishing school soon), but now I'm back and I would really appreciate any help you guys can provide. I still have the exact same problems (it's a shame code can't fix itself...) I'm attaching here a solution (.sln file) with the relevant files from my project. Keep in mind that I did not put the database files and the web service I have, so trying to access those may cause runtime errors, although the website is supposed to treat you as a 'guest' and not allow access in the first place. The code is a bit messy since it's my first time building something of this size and complexity, but you should not need to work with all of it. I marked the place that I believe to be the problem, inside the "Body()" prototype function in the "Graphics.js" file. The problems are definitely related to the implimentation of the cannon physics engine, so I'll write about the other places where it's interacted with in the same file: In the top of the code, right after creating the scene, the cannon plugin is created. In the "play" and "playback" functions (those are click events for buttons) the time step and gravity vector are set. In the "FrameForward" function impostors are set to sleep and to wake up, and there are get and set actions for their velocities. In the "Body" prototype function (as I wrote above) impostiors are created and are put to sleep. This is where the program gets first while running, hence where problems appear. I will now provide some basic instructions for how to use the project as a client: There is only one html page called "Workshop". In the middle of the page there's a canvas element, on which the simulations appear. You can move the camera with the mouse: left button and drag is left-right and up-down translation. right button and drag is yaw and pitch rotation. scrolling the wheel is forward-backwards translation. both buttons (left and right pressed together) and drag is roll rotation Under the canvas there are radio buttons, each opens a menu. These should be pretty obvious. The one you need is "Create Body". Here you enter the properties of the body you want to create (mass, position etc..). After creating the body there should be an exception in the "babylon,js" file, which is my problem. Lastly, right to the canvas there is a "play" button. If the error still exists, the created bodies should appear on the screen but not move when you press "play". If they do move then you got something different then me. I know that's a lot of information for one post, but it's actually not that complicated. I tried making it pretty intuitive to use. If you have any problems please let me know (both to help you help me and to make my project better). Looking forward for your reply. Thanks in advance@Deltakosh @RaananW @Steffen PhysicsProjectSolution.sln Workshop.aspx.cs Workshop.aspx Web.config Graphics.js cannon.js babylon.js babylon.d.ts FormSheet.css Edit: I just realiezed it wouldn't let me upload it as a folder, so I'll explain how to organize all this: You should have a main folder in which all files will be. Inside it you should have a "PhysicsProject" folder, and the "PhysicsProjectSolution.sln" file Inside "PhysicsProject" you should have a "CSS" folder and a "js" folder. It's important to have those names exactly because my code searches in them. inside the "CSS" folder you should put "FormSheet.css" inside the "js" folder you should put "babylon.js", "cannon.js", "Graphics.js" and "babylon.d.ts" files. All other files should be in the "PhysicsProject" folder without any other sub folders. Quote Link to comment Share on other sites More sharing options...
SuperPudding Posted June 28, 2016 Author Share Posted June 28, 2016 If anyone still checks this thread, I want to let you know that I haven't been able to make this work. The due date for submitting the project came recently and I had to submit and present it without collisions. Fortunately it was good enough to grant me a 100 (the highest score) despite that. I would still like to know how to solve it if anyone has a suggestion... Thanks everyone here that helped me along the way, especially @RaananW, @Deltakosh and @Steffen. 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.