Dad72 Posted February 1, 2014 Share Posted February 1, 2014 Hi, The target update no longer works with the rotating camera. It worked before. The code that I have given you in the link worked and now when I click on ALT, all the scene disappears. I used a camera free to move on the ground freely and then a rotating camera with the ALT key to observe an object. Try this example. If you click ALT, this should go to a rotating camera which turn around the Box, but the screen becomes purple. Test change camera with target update Thank you Deltakosh Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 1, 2014 Share Posted February 1, 2014 Hello I'm sorry but the bug is not on my side This line : camera[1].radius = valeurBoiteMax + 20; uses a valeurBoiteMax which is undefined Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 1, 2014 Author Share Posted February 1, 2014 I am confused. Yesterday it work not. Today I tested the example and it work. It may be my browser?However, on my project in development, the bug was still present and i have resolved with parseFloat() (It is sometimes forgotten) cameraArcRotative[0].target = new BABYLON.Vector3(parseFloat(_mesh.position.x), parseFloat(_mesh.position.y + 3), parseFloat(_mesh.position.z)); Quote Link to comment Share on other sites More sharing options...
Boz Posted May 4, 2014 Share Posted May 4, 2014 Hey there ! I have a question if you managed to get it work.I want, like dad72, define a target for my arcCamera as a mesh position. So I create my mesh and apply the target like this :BABYLON.SceneLoader.ImportMesh("him", "models/Dude/", "Dude.babylon", scene, function (newMeshes, particleSystems, skeletons) { // Get mesh and initialize it dude = newMeshes[0]; dude.position = new BABYLON.Vector3(0, 0, 0); // Adjust camera relative to mesh arcCamera.target = dude.position;});All is ok, the camera aims the mesh.I move my mesh with keyboard inputs and the camera follows perfectly the mesh. But I just want to put my camera a little higher, to have a better overview. So I replacearcCamera.target = dude.position;by :arcCamera.target = new BABYLON.Vector3(dude.position.x, dude.position.y+3, dude.position.z);When I initialized the scene, great, this is how I wanted !But when I move my mesh, the camera does not follow Neither with the parseFloat suggestion by dad72. I don't know if when I define the target as mesh.position, this is a pointer on a Vector3 ?And with the 2nd solution, the Vector is simply copied when created ? If you have any suggestions to help me putting my camera a little higher, it could be great Thanks !Pouet-- EDIT : It works only if I define the target as the 2nd way in a loop, so the computation is made every time. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 5, 2014 Share Posted May 5, 2014 This is logical. The camera uses its target as an object. I mean, if you give the position of the mesh it will use mesh.position each time. If you use "new BABYLON.Vector3(dude.position.x, dude.position.y+3, dude.position.z);" then you create a new object no longer related to the mesh.position (It is just a copy ten) 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.