Jump to content

[fixed] ArcRotateCamera, Unable to undo "setTarget(mesh)" without moving mesh first


aWeirdo
 Share

Recommended Posts

Hi guys, i notised that if you use arcRotateCamera and setTarget(mesh) you're unable to unlock the target, e.g setTarget(mesh.position.clone()); without updating the mesh's position first,

i'm using 2.5, but it is also available in the PG;


// Press any key to setTarget(sphere), press again to setTarget(sphere.position.clone()), try to pan using the left mouse button, you're still stuck, uncomment line 33 ( sphere.position.x += 0.00000001;), do it again and now you can pan..
Example; http://www.babylonjs-playground.com/#WHMIR#0 

 

Fix has been merged, thanks @Deltakosh 
https://github.com/BabylonJS/Babylon.js/pull/1740

http://www.babylonjs-playground.com/#WHMIR#6

 

Link to comment
Share on other sites

Yeah, your sort of right.  I added a optional arg in 2.5 to use the center of bounds, for meshes with "feet on the ground".  I do not have a foot fetish :P.

There is an optimization not to do really do anything then setting the target to something in the same location.  I did not add it, so I left it there.  If this is only being done for optimization reasons, I think it would be better to pull this check out.  Really how many times is this going to be called.

Link to comment
Share on other sites

@Temechon camera.isLocked is just a variable i made up to keep track whether the camera was locked or not :) 

the issue seems to be related to the setTarget function, it does not happen when using camera.target instead of camera.setTarget..

http://www.babylonjs-playground.com/#WHMIR#4 

Edit; 
Ahh @JCPalmer That must be the cause then ^^

 

Edit 2;
Made a PR https://github.com/BabylonJS/Babylon.js/pull/1740
added a optional boolean to allow same position

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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