SuperPudding Posted January 18, 2016 Share Posted January 18, 2016 Hello guys, First of all this is my first time here on the forum, but I have read some of the other posts and they've been of great help, so thanks for everyone here already. I'm new to web developing and even newer to babylon.js so my problems may be simply caused by a lack of knowledge. Anyway, I'm trying to develop a project and I have some problems with moving the camera, I believe they are somewhere in the registerBeforeRender function. In order to make the camera able to rotate in any direction I attached it to a parent mesh and I'm moving it instead. In my html page I have a button, which upon being pressed should make the camera move to a certain position and rotate in a certain direction. I wanted the movement to be "fluid" (the camera doesn't "jump" to said position but rather the user sees its movement), so I move it in the registerBeforeRender function, a little bit every time. My problem is that in some cases something goes wrong and the function collapses. I'm left with a blank canvas and all the meshes dissappear. If anyone knows why that might happen I would appreciate an adive. Sadly I can't add my code right now as it's on another computer, if it's too hard to help me without it I'll upload it here soon. Thank you in advance. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 19, 2016 Share Posted January 19, 2016 Hi Mr. Pudding, welcome to the forum :-) Without code it will be hard to help you. But, have you considered using a follow camera instead of attaching a camera to the mesh? Might be a simpler solution. SuperPudding 1 Quote Link to comment Share on other sites More sharing options...
SuperPudding Posted January 20, 2016 Author Share Posted January 20, 2016 Update: Found the problem. It wasn't so much the registerBeforeRender function itself but rather an unhaldled exeption from a math function that was called form it. I discovered that Vector3.normalize() can set the length of the vector to a little bit more than 1. That caused a problem in the arccos function (I was trying to get the angle between two vectors). By the way thanks for the tip RaananW, I do not know how to use the follow camera yet but it might be helpful. 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.