Jump to content

gravity is on but my camera don't fall !?


dav74
 Share

Recommended Posts

Hi,

I'm trying gravity on a freeCamera :

var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine);var camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 15, 0), scene);camera.attachControl(canvas);var light = new BABYLON.PointLight("pointLumineux1", new BABYLON.Vector3(100, 100, 0), scene); var plan=BABYLON.Mesh.CreatePlane("sol",200,scene);plan.rotation.x=Math.PI/2;var cube=BABYLON.Mesh.CreateBox("boite",5.0,scene)cube.position.z=40;var mat= new BABYLON.StandardMaterial("matCube",scene);mat.diffuseColor = new BABYLON.Color3(1,0,0);cube.material=mat;scene.gravity = new BABYLON.Vector3(0, -10, 0);camera.applyGravity = true;engine.runRenderLoop(function () {     scene.render(); });

camera don't fall, why ?

thank you for your help

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...