Michael3D Posted September 13, 2017 Share Posted September 13, 2017 Hi, Here is a basic scene to what I have so far:http://www.babylonjs-playground.com/#ZR4JTA#1 What I am trying to do: I am trying to make a camera that rotates around a parent object (sphere in my scene) without centering the target(what the camera looks at) to the parent. Desired outcome: When click and moving the mouse button, the parent object will be placed in the location "clicked" and the camera and target will rotate around the position of the parent object. What I tried: My idea's was to solve this were to find a way to remove the camera looking at the target, but been able to move and rotate around the target's position without the camera focusing on the target's position. This could still be the easier way, but I just cant figure out how to do this. Note: The zoom would still zoom in/out to the target, the same way as google maps zooms in on the mouse point, rather then the center of the screen. any help would be helpful. Thanks. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 19, 2017 Share Posted September 19, 2017 Hi Michael3D, and welcome. Sorry for slow replies. https://www.babylonjs-playground.com/#ZR4JTA#4 Here, I removed the camera.parent, but I am still placing the sphere at the pickedPoint. In the pointerDown func... lines 40-50, I used a camera.setTarget(pickResult.pickedPoint); in line 45. This sets the ArcCam's .target to be the clicked point upon the mesh. In line 46, I move the camera itself, using a fancy .addInPlace tool. I'm not sure if you wanted to change camera position with each click, but I think that is what you were trying to do... by using camera.parent. Parenting the camera WOULD work, and might still be needed IF the boxes start moving-around, and you need the camera to track the box movement. I tried some cam position (not target) tracking in #5 playground, but I got interrupted by real life crap. Sometimes folks just want the arcCam target to move, and sometimes they want the target AND the camera itself, to move. I hope this helps. Others may comment soon. Quote Link to comment Share on other sites More sharing options...
Michael3D Posted September 19, 2017 Author Share Posted September 19, 2017 Hi Wingnut, Thank you for your help. That's not really what I was trying to do, I was trying to make the .target and camera to become a child of the sphere. But when clicking a new position for the sphere, the position of the target wouldn't change, only when holding "click" and the target would rotate around the spheres rotation. I had talk to another person, and after many tries, we decided that there was no easy solution to getting the results we wanted without a lot of changes to creating out own camera properties. Did I make it more clear to what action I was looking for? Thanks, 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.