Search the Community
Showing results for tags 'followcamera'.
-
Hi guys and gals, I was reading the docs on Customizing Camera Inputs https://doc.babylonjs.com/how_to/customizing_camera_inputs and I want to customize the camera input for the FollowCamera. But it has no camera.inputs set at the moment when I look at the definition: https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.followCamera.ts While for example the FreeCamera has: https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.freeCamera.ts#L164 My question is: Can you set the camera.inputs to a new CameraInputsManager instance? Perhaps a DummyCameraInputsManager that's just an empty shell, doesn't need to do anything with input for now... just being there. So then I can add my own inputs to this camera using: camera.inputs.add(new MyFancyNewFollowCameraKeyboardInput()); I can then write camera input controllers (in JavaScript) that would adjust the FollowCamera's radius, rotationOffset and heightOffset. If you like my camera input controllers for the FollowCamera I can share the code, so they might even become default. ? Some background info: I use a FollowCamera in my BabylonJS Model Train Simulator game. It follows the train quite nicely, even in curves. ? But when the train gets longer, I want the user to be able to adjust the radius to get the train in view again (zoom in/out). Also when the player operates the train at a station, I want the user to be able to adjust the rotationOffset to get a clear view on loading/unloading the train at that station. So it's kinda like an ArcRotate input but slightly different. Let me know how I can help achieve this or if there's a similar solution that achieves more or less the same. Thanks, Quintus
- 9 replies
-
- inputs
- camerainputsmanager
-
(and 1 more)
Tagged with:
-
Yo dudes In my continuing quest to work with Babs for my client project, I'm exploring how to control cameras in response to user actions such as clicking. As usual I have more questions than answers... The idea is to move the camera to a position in front of a chosen mesh within the scene. I've got a very simple scene going where, upon detecting a click, I create a follow camera, set its position and rotation to the active arc camera, then define the camera target and let it animate to it. Some questions on this approach: 1) There's a shift in position when switching active cameras from arc to follow. Any reason for this? I set position and rotation to match, but I must be missing something else from the arc camera when switching to the follow camera. Lets face it, I usual am. 2) Detecting a click is a bit of a pain. Not in itself, but when it comes to determining if the user was rotating the scene with the mouse button, or actually clicking a mesh in the scene, when releasing the mouse button it's less than clear. Are there any recommended strategies to follow for this? I looked at the ActionManager example PG (http://www.babylonjs-playground.com/?17) but it has the same issue; if you click down over one of the shapes, move the scene around a bit with the mouse button still down, then move the scene so the original clicked object is under the mouse when you release the button, it's considered a click. Seems obvious to me there should be some clear method to distinguish the two actions, but don't ask me what the solution is because i don't have a scooby. 3) Is there a way to detect when the follow camera finishes animating to the target? Looks like there isn't but I'd have thought this would be useful to someone (me) at some point (now). 4) Is there a way to reverse the animation of the camera. For example once the camera reaches its target, can we make the camera reverse back to where it started with a click of a button? Probably I'm expecting far too much and I'll have to consider other options (maybe create paths to clickable objects and animate the arc camera along them) but would be great to know for sure. Cheers!
-
Hello guys, I have a scene with a FollowCamera and I need to switch between multiple targets. For some reason though, I cannot get to make the switch smooth. When setting lockedTarget directly it jumps from one position to another. I tried to make an animation with the "lockedTarget" property but it doesn't work. Maybe you guys could help me out? PG: https://www.babylonjs-playground.com/#9AXYDK#1 Thank you!
-
Let's use this PG as an example: http://www.babylonjs-playground.com/#1PX171%2323 (WASD keys). Driving forward makes the camera follow the vehcile properly from a distance behind it. Now, when you go backward, the camera shifts direction and follows the vehicle from the rear end. I do not want this particular functionality in my example. I've looked through PG's, and they don't seem to have this issue. Another example is the Distraction Demo: https://www.babylonjs.com/demos/distraction/distraction.html I don't see any changes to the FollowCamera code base between these two versions of Babylon, and even if I use the same (default) settings, the weirdness remain. Is there any way to keep the camera fixed, without having to recreate a followcamera myself?
-
I have an issue where I am using the followCamera in a top down view (think original grand theft auto). It works fine except when I apply impulse to my character/mesh/imposter to where the character moves backwards, the camera rotates a full 180 degrees. I want the camera to stay in the position so that it never rotates. Meaning, the north portion of the map will always be north, regardless of the direction of the character/mesh/imposter the camera is following in the top down view.
-
Hi guys! As I can see camera target is being set to mesh's absolute position (https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.followCamera.ts#L46): var targetPosition = cameraTarget.getAbsolutePosition(); Is it possible to somehow set an offset to camera target? So for example when we're following a character, by default the camera will be pointing to middle of the character mesh, but what if I want to point the camera to characters head or even above it, how could I achieve that? Hope my question is clear enough. Initially I posted the question here, but following JohnK suggestion I'm creating this new separate topic for the question.
-
Hello guys, I'm pretty new to Babylon.js and doing some demos. Right now I'm trying to implement a platformer physics like Mario Galaxy. But I'm having some problems getting a 3rd Person Follow Camera around Planet working :s This is what I have right now: http://www.babylonjs-playground.com/#2IYTT I'm trying to do a camera that will follow my character around the planet, an effect similar to Prosecution Demo: http://cdn.babylonjs.com/wwwbabylonjs/Scenes/prosecution/index.html Any help would be praised! Thanks in advance
- 1 reply
-
- planet
- followcamera
-
(and 1 more)
Tagged with:
-
Here is a little bit of nonsense, mainly a movie but there is an interactive choice to make, will you do it or not? http://www.babylonjs-playground.com/#124DXA#20 Anyone fancies adding sound, or other improvements? It will be interesting to see if there any developments and what they could be.
- 4 replies
-
- followcamera
- click
-
(and 1 more)
Tagged with: