• Content Count

  • Joined

  • Last visited

About hfeist

  • Rank

Recent Profile Visitors

486 profile views
  1. Hey Adam--thanks for that. I've added the ability to move backwards by holding shift down window.addEventListener("keydown", function(e) { var keycode = e.which; if (e.keyCode == 16) { speed=-1*speed;; } }); window.addEventListener("keyup", function(e) { var keycode = e.which; if (e.keyCode == 16) { speed=-1*speed;; } }); Just needed to set a flag so the speed gets locked down when the script first runs: if(flag==false){ flag=true; speed = camera._computeLocalCameraSpeed()/4; } Here it is in action:
  2. I'm a little slow: I can get the tilt angle by also checking the camera.rotationx and camera.rotation.z values
  3. thanks for going to so much trouble. i'm trying to understand it well enough to find where i might create a loop that keeps you moving as long as the mouse is down just as it does as long as a nav key is held down
  4. thanks for the pointers. certainly looks daunting! but i've added it to my project and can see the camera inch forward ever so slightly at each mouseclick. would much prefer to keep moving as long as the mouse is down. and perhaps move backward if the shift key is down. and i can see no mention of mouseup or mousedown so guess it's an entirely different way of doing things.
  5. I'm trying to find a way to use the mousedown event to move the camera forward. I've mapped the keys so that T moves forward and want it to fire whenever there is a mousedown event. I have come up with the following but cannot get the keypress function to fire when there is a mousedown. Any suggestions would be most welcome. In the scene setup I've set the forward key to: camera.keysUp = [84]; // T After the scene setup I've added: document.addEventListener("mousedown", function(e) { var code = 84;//T $('document').trigger( jQuery.Event('keypress', { keyCode: code, which: code }) ); $("#show").append("mousedown creates: " + code + "<BR>"); }); document.addEventListener("keypress", function(e) { var key = e.which; $("#show").append("key code:+key+"<BR>"); //If it's the T key if (key == 84) { $("#show").append("T key has been pressed<BR>"); } }); // I would like the mousedown event to fire the keypress event // as if the T key has been pressed there is a div in the body to display the output: <div id="show"></div>
  6. I was wrong. We were having db maintenance going on and my positions weren't being saved. I can now get the camera to return to the saved x,y and z positions and the rotation works as well just by setting the camera.rotation.y to the saved value. Now if I could save and retrieve the tilt angle of the camera I'd just about have things working perfectly. Thanks so much for the help!
  7. I've also tried camera.position = new BABYLON.Vector3(firstX, firstY, firstZ); and camera.position = new BABYLON.Vector3(-0.6, -4, 5).addInPlace(new BABYLON.Vector3(firstX, firstY, firstZ)); but the position doesn't change
  8. Thanks, works great! Of course now I'm stuck trying to set the camera postion to the values I've collected. Just setting them simple-mindedly like so doesn't work: camera.position.x=firstX; camera.position.y=firstY; camera.position.z=firstZ; camera.rotation.y=firstR;
  9. I am trying to capture a FreeCamera's location and pan angle or rotation so I can reposition the camera later with the exact same view. (I am working with the playGround Collision example) I seem to be able to get camera.position.x, camera.position.y and camera.position.z ok but camera.cameraRotation.y just yields zero every time