kevzettler Posted February 17, 2017 Share Posted February 17, 2017 I have an ArcCamera with a root object as it's target. I'm going for a 3rd person or "over the shoulder camera". I want the root to rotate on the y axis when the ArcCamera moves on the alpha axis. I'm currently doing something like: Quote root.rotation.y = -1 * camera.alpha; It seems like the alpha is at a lower magnitude than what the rotation vector expects. I can rotate the camera like 3 times around the root before it rotates completely Quote Link to comment Share on other sites More sharing options...
Temechon Posted February 17, 2017 Share Posted February 17, 2017 Hey, I'm not sure if I can help, but did you take a look at ArcFollowCamera ? http://doc.babylonjs.com/classes/2.5/arcfollowcamera Quote Link to comment Share on other sites More sharing options...
kevzettler Posted February 21, 2017 Author Share Posted February 21, 2017 I have looked at ArcFollowCamera it dosen't seem to be working for though. Once attached to a target to follow I cannot control it. I setup a playground here http://www.babylonjs-playground.com/#4FC2X#0 Also to get the desired effect I want, I would still have to rotate the target mesh based on the ArcFollowCameras alpha. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 21, 2017 Share Posted February 21, 2017 Hello using the ArcRotateCamera should work but as you already found out, the camera.alpha is an angular rotation (based on a radius). To help you , can you provide a PG with your initial setup? (With the arcrotatecamera and the mesh) Quote Link to comment Share on other sites More sharing options...
kevzettler Posted February 21, 2017 Author Share Posted February 21, 2017 @Deltakosh I'm having a hard time reproducing my setup in the playground environment. Playground is using v2.6-alpha I'm not on the same version. Actually I'm not sure what version I'm using is there a value I can check? Even so seems like coordinates are different between the two environments. Here's my best attempt at reproducing http://www.babylonjs-playground.com/#GVPCK#4 Here's a better example on my production environment http://localhost:8000/robotbones/attempts/babylon/babylon-bones-qubicle-CEWBS/ Essentially I want the character to face the direction the camera is facing on rotate. I thought I could maybe use the alpha from the rotateCamera but maybe I can take the a direction vector from the character to traget and apply that to the character instead. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 21, 2017 Share Posted February 21, 2017 Hello, you can check engine.Version to get your version You can also think about using some code from camera.getFrontPosition: https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.targetCamera.ts Quote Link to comment Share on other sites More sharing options...
kevzettler Posted February 24, 2017 Author Share Posted February 24, 2017 thanks @Deltakosh I was able to get the effect I want by doing focus = arcCamera.getFrontPosition(100); focus.y = 0; focus.multiplyInPlace(negativeVector); mesh.lookAt(focus); How do I move the camera towards that direction? I'm currently moving the mesh with mesh.translate when keys are down. I want to do the same movement with the camera. Seeing the camera dosen't have a translate method Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 24, 2017 Share Posted February 24, 2017 You have to just call arcCamera.setPosition(newPosition); 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.