Alex10 Posted December 25, 2015 Share Posted December 25, 2015 I want to limit the rotation of freeCamera up and down. Because if the FPS shooter used cars or tank then when you turn it down, it buries itself. And the tank can't be at 90 degrees to the sky or the ground. Marc Dequette 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 25, 2015 Share Posted December 25, 2015 Hi Alex10, good to see you again. Um, do you have the vehicle parented to the camera? If so, maybe you should undo that. http://playground.babylonjs.com/#1X4ODI#2 There is a nice little vehicle-moving demo. The vehicle is the green box, of course. I used our following free camera, and didn't attach it to the canvas, and didn't set a standard target. I set a special target made for the followCamera... late in the code. I stole the mouse-on-canvas tracking code from some webpage. This will keep your vehicles out of the mud. I am not very good at things like this, but this seemed to work ok. My code is probably sloppy (which matches my entire life). No clicking needed. Move mouse right/left to turn the vehicle, and forward/backward to drive. I'll let you study it on your own. Our followCamera has some properties to play with, if you wish. BabylonJS also has an arc-rotate follow cam... but I haven't tried it yet. Hope this helps. Be well! Quote Link to comment Share on other sites More sharing options...
Alex10 Posted December 25, 2015 Author Share Posted December 25, 2015 A freeCamera can't be? With easy freeCamera fps with mesh of people do, i can freely down the top of the watch.Very much don't want to change the camera. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 25, 2015 Share Posted December 25, 2015 Hi again Alex. Overhead view/close-follow view - toggle? Easy. http://playground.babylonjs.com/#1X4ODI#3 Line 47/48 - camera.heightOffset. Did you experiment with this? You CAN do this with a freeCamera, too... but you will need to write FOLLOW code if you want it to follow your vehicle. BabylonJS cameras are very versatile (adjustable)... but sometimes it requires patience and experiments. I am having difficulty understanding your English, sorry. Quote Link to comment Share on other sites More sharing options...
Alex10 Posted December 25, 2015 Author Share Posted December 25, 2015 How to find angle for freeСamera in relation to the plane ? I think camera.cameraDirection it does not quite fit? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 26, 2015 Share Posted December 26, 2015 Maybe... var DirX = BABYLON.Tools.ToDegrees(camera.rotation.x); var DirY = BABYLON.Tools.ToDegrees(camera.rotation.y); var DirZ = BABYLON.Tools.ToDegrees(camera.rotation.z); Alex10 and iiceman 2 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.