Jump to content

Simple Physics Link Trouble?


mediabounds
 Share

Recommended Posts

I would have expected it to work with a mass.

 

Bigger picture, I want to chain together a number of spheres that "lean" towards whatever direction gravity is pointing. Like a chain or beaded necklace or something. Without a mass, the objects won't respond to gravity.

Link to comment
Share on other sites

So I've been digging through the Physics example on babylonjs.com trying to figure out what the difference was between it's linked object and mine, but nothing was jumping out.

 

But it turns out the difference was in the environment: Apparently one render loop has to run first before I can set the physics links.

 

http://www.babylonjs.com/playground/#1LXLMJ#2

 

It doesn't actually matter if the scene has been created yet or not--as long as the render loop has run at least once. For example:

This does not work:

var canvas = document.getElementById("renderCanvas");var engine = new BABYLON.Engine(canvas, true);var scene = CreatePhysicsScene(engine);var renderLoop = function() {	scene.render();};engine.runRenderLoop(renderLoop);

But this does:

var canvas = document.getElementById("renderCanvas");var engine = new BABYLON.Engine(canvas, true);var scene;var renderLoop = function() {	if (scene) {		scene.render();	} else {		scene = CreatePhysicsScene(engine);	}};engine.runRenderLoop(renderLoop);

I'd be really interested in the explanation if anyone knows!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...