Jump to content

Bug with target update arcRotateCamera (1.8.5)


Recommended Posts



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

Link to comment
Share on other sites

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));
Link to comment
Share on other sites

  • 3 months later...

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 replace

arcCamera.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 :D

Thanks !



EDIT : It works only if I define the target as the 2nd way in a loop, so the computation is made every time.

Link to comment
Share on other sites

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)

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...