mightyboat Posted February 27, 2016 Share Posted February 27, 2016 Hi, I need to generate a terrain mesh procedurally. I am currently doing it with lots of sprites stuck together in a line to generate the contour of the terrain. It works fairly well, but has a few quirks and seems to affect performance badly. What I was thinking of doing is generating the points in the preload function, then from that, draw a line to rendering the terrain, and then use the same points to generate the collision polygon. The issue I found is that the game.load.physics() function works with a url to a json object. Is there a way to pass it a json object that I created in the game itself instead of a url? By the way, I am using P2 physics for this. Link to comment Share on other sites More sharing options...
mightyboat Posted February 28, 2016 Author Share Posted February 28, 2016 After a bit more seraching I finally stumbled upon an example. apparently theres a third argument to the physics functions which allows you to load a json object like so: this.load.physics('physicsData', '', this.tunnelPhysicsData); Link to comment Share on other sites More sharing options...
Recommended Posts