Search the Community
Showing results for tags 'Freecamera'.
-
I have free camera in orthographic camera mode. I don't want camera to move at all on mouse or any other kind of input. So I tried not calling attachControl with this, camera doesn't react at all (Good!) but boxes in this scene with actions registered to action manager also do not react to mouse inputs. Second approach I tried is calling attachControl with following function: scope.registerBeforeRender(function () { // I want top view camera.rotation.x = Math.PI / 2; camera.rotation.y = Math.PI / 2; camera.rotation.z = 0; }); When I try to move ground with mouse it does move slightly. As shown in image. Help needed.
-
Hi I have applied a freecamera to my project. camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(-40, cameraHeight,-132), scene); I have applied gravity to it so that it won't fly ie: camera.applyGravity = true; I have given it a constant height (cameraHeight) scene.registerBeforeRender(function () { scene.activeCamera.position.y = cameraHeight; }); Now the problem is that when I move the mouse up and down along the Y axis the camera rotates (in essence on the x-axis). So the camera is elevated and it's like flying.I have checked the ESPILIT demo and it's the same problem (Espilit.babylon has camera gravity enabled). So is there a command which limits the rotation of the free camera up and down (or left and right) ? If I need to calculate the rotation in registerBeforeRender then my 2nd question, can I stop a camera?
- 5 replies
-
- gravity
- freecamera
-
(and 2 more)
Tagged with:
-
I would like to be able to switch between ArcRotateCamera and FreeCamera with as little motion as possible. I haven't been able to figure out: 1) How to get the FreeCamera to face the same direction as ArcRotate was when switching. 2) How to remove the 'spinning' effect when switching. You can 'coil' a camera up by rotating it several times and after switching, it 'uncoils' itself by rapidly spinning. I thought that for FreeCameras this number is stored in .rotation.y and .alpha for ArcRotateCameras, but limiting these to ±Math.PI doesn't fix this issue. Don't really want to set inertia to 0 because I like inertia PLAYGROUND LINK
-
Hi, there. How to make a FreeCamera rotate only by Alpha rotation? Only longitudinal? I want to turn off a Beta rotation (up and down rotation of camera). Thanks.
- 4 replies
-
- freecamera
- rotation
-
(and 1 more)
Tagged with:
-
Hi gang! Once before, I tried adding mousewheel to FreeCamera. I try again, for fun. http://playground.babylonjs.com/#6FHKHC#7 Watch console. Working okay, so far. But, you know, I would like mousewheel to move camera along direction vector returned-from scene.activeCamera.getDirection(BABYLON.Axis.Z) Currently, mousewheel moves camera along worldspace Z axis. If someone could fix line 33, so that camera moves along dir.z axis, that would be swell. Thanks! For a longer-term solution, does anyone think it would be wise/useful... to add babylon.freeCameraMouseWheelInput.ts to this list: https://github.com/BabylonJS/Babylon.js/tree/master/src/Cameras/Inputs ? The way I am using... is small and works pretty good, but it is not using the camera inputs system. Maybe it should? *shrug* Comments welcome on that. thx.
- 2 replies
-
- pointereventtypes
- onprepointerobservable
- (and 4 more)
-
So I have a ArcRotationCamera that is fixed on a target sphere. When I click a different sphere, I would like to animate the camera to move to and zoom in on the new target. Unfortunately I haven't been able figure out how to smoothly animate ArcRotateCamera switching to a new target like that, so my solution so far has been to switch to a FreeCamera, which I can then animate to the new target, and afterwards switch back to the ArcRotateCamera on the new position. Unfortunately the perspective is bugging out and is very janky to say the least. Basically the camera should turn towards the targeted sphere like the box does in this example: https://www.babylonjs-playground.com/#UMQ4UR#2 It seems like something that should be so simple to do, but I've been stumbling around this problem for a couple of days, and this is the best I've come up with so far: http://www.babylonjs-playground.com/#WG9OY#28 Anyone who knows a proper way to solve this problem?
- 5 replies
-
- freecamera
- animation
-
(and 1 more)
Tagged with:
-
Hey everyone ! Yesterday, I tried to upgrade my scripts to the the latest version but I found a little problem I think. When I increase the FreeCamera speed, the sensibility or sensitivity (I don't know which word I should use) just goes wrong So I recreate the problem here : https://www.babylonjs-playground.com/#THZIQ2#1 Can someone tell me what can I do to fix this problem ? Thank you in advance!
-
Hey guys, is there a posibility to fix the FreeCamera's position. So the camera won't move on key-press. I just want to rotate the camera on key-press. Thanks in advanced Benji
-
Hi all, Update - 17 / 02 mesh.collisionGroup = maskNumber; have been added to AbstractMesh. Two new properties, collisionGroup and collisionMask, have been added to AbstractMesh, collisionMask have been added to FreeCamera, and is coming with 2.6. Why? What do they do? The collisionGroup & collisionMask checks whether a camera Vs mesh or mesh Vs mesh collision should happen. Thus, it allows us to customize collisions, enabling us to decide what meshes should collide with each other and which meshes should collide with the camera An example could be to have collisions between the camera and a box aswell as the camera and a sphere, but no collision between the sphere and the box all at the same time. Once it's live, it will work like this; var group1 = 1; // x to the power of 2, starting from 1. var group2 = 2; // 1*2 = 2 var group3 = 4; // 2*2 = 4 var group4 = 8; // 4*2 = 8, and so on. // This mesh is part of the group1 collisionGroup, camera's and other (moving) meshes with group1 in their collisionMask will collide with this mesh. mesh.collisionGroup = group1; // While moving, this mesh will collide with other meshes which has either group1 or group2 as their collisionGroup mesh.collisionMask = group1 + group2; // While moving, the camera will collide with meshes which has either group1 or group2 as their collisionGroup camera.collisionMask = group1 | group2; // doing group1 | group2 has the same effect as, but is less dynamic than, group1 + group2 You can also do; camera.collisionMask = group1; // Set mask to collide with group1. camera.collisionMask += group2; // Set mask to also collide with group2. camera.collisionMask -= group1; // Remove group1 from mask so we only collide with group2. // Take careful note before using this method, to avoid issues, you must first override the default mask (-1) by doing cameraOrMesh.collisionMask = your_group_x_variable; It is currently not available for webworkers. Backwards compatibility, If this isn't something that interests you, you're all good, nothing has changed. Masks Masks are numbers to the power of 2, starting from 1. Special masks -1 ; Always collides. 0 ; Never collides, overrides mask -1. // not recommended to use on camera with standard gravity applied. Standard masks , x to the power of 2; 1 | 1*2 = 2 | 2*2 = 4 | 4*2 = 8 | 8*2 = 16 | etc. 1 2 4 8 16 Etc PG Example; The camera collides with the ground & box, but not with the sphere and the sphere and box doesn't collide with each other either. http://www.babylonjs-playground.com/#20PQBI#43 Cheers. If you have any questions, ideas or thoughts, please do continue the discussion below.
-
Hi all I have a free camera which has a mesh which in front of it which is 70 cm wide (x) and 110 cm length (z) with it's pivot point at the its center. Now I want this mesh to be constantly in front of my free camera when the camera is moving. The problem starts when I start to rotate the camera. I want the mesh to be in the center of the screen (in the direction of the camera) and at a fixed distance from the camera. Is that possible? Does it involve complicated math calculations? Would a followcamera do the job? cart.babylon
-
I'm using a FreeCamera, gravity,etc... and when i look at the sky and press W to go forward i go up and can fly, the same if i look at the floor and press back. I want that with WASD the camera moves without take the Y.rotation in consideration, because i still need to move the camera and rotate to look everywhere. How can i achieve that? I tried with "Camera.CamFrontX(Distance)" , Camera.DirectionX(AxisX, AxisY, AxisZ) ,etc... to fix the Y.Rotation value but never got the desired behaviour, sometimes the Y is limited and i can't climb ramps or stairs, other the collisions are not detected or other weird stuff.
-
Hello, I think I am not very well understood the function of the rotation properties on a free camera ... Watch this playground: http://www.babylonjs-playground.com/#HAAJ3#0 Why does my variable rot changed? I think I must be so tired to understand the problem If someone has an explanation for this problem thank you. Ps: It works very well with an arcRotatecamera by adjusting Alpha and Beta values. Thanks
-
Hey Guys, I intend to change the use of arrow keys for FreeCamera. I want the camera to rotate around its axis when pressing the left or right arrow keys as opposed to its current movement to left or right. How can i do this? I tried setting noPreventDefault to false in camera attachcontrol but it dosent seem to stop the movement of camera left or right. Am i missing something here? Thanks
-
I am trying to capture a FreeCamera's location and pan angle or rotation so I can reposition the camera later with the exact same view. (I am working with the playGround Collision example) I seem to be able to get camera.position.x, camera.position.y and camera.position.z ok but camera.cameraRotation.y just yields zero every time
- 5 replies
-
- inputs
- camera rotation
-
(and 1 more)
Tagged with:
-
Hello, I've been adding features to my game, and came across a weirdness that I don't know how to explain! I've created the basis for my question here. There are a number of objects in the game scene, and I want the player to be able to choose one to look at. I am using the FreeCamera, since it suits my purposes. After adapting the TargetCamera.setTarget function to return the rotation vector of a camera without setting its target explicitly, I can now create an easing animation which gracefully orients the camera in that direction. The link above demonstrates this working in a loop which starts one animation, then on completion, selects a new random target, and starts the animation all over again. The problem is Line 45: camera.rotation.z = 0; Without this line, at the end of the animation, the camera.rotation (normally a Vector3 with x,y,z) becomes a Vector2 with x,y. This causes the screen to go black after the last frame of animation. Now, my two questions: 1. Why? It seems to me that dropping the last part of a Vector3 at the end of an animation is a bug, but my inexperience with BabylonJS makes me think there is probably a better explanation. 2. Is there a better way that I could animate a FreeCamera's orientation? Thanks for your time, and if this solves a problem for anyone, please enjoy the code Cheers, - Peter
-
Hi there, I'm having a problem getting a playground sample to work on my xampp localhost, I got the Zip file of the Collisions example from the playground (http://www.babylonjs-playground.com/# -9 Collisions), the freecamera works perfectly when I run the online example, but when I test it on the localhost, the camera won't move at all, it will rotate with the mouse, but will not respond to my arrow key presses. Can someone explain why does the example works online and not on local ? Update: When tested using Internet Explorer, it works, but does not work using Firefox or Opera. So is there a difference between IE and other browsers conserning handling local html files ?
-
Hello, When I am using free camera and attached controls, camera is falling only for about 1 second and than stops. I have to press control key to begin falling again. Can increase this duration or give camera instruction to fall (something like moveWithCollisions )? http://www.babylonjs-playground.com/#21AD8N Thanks!
- 2 replies
-
- freecamera
- camera
-
(and 3 more)
Tagged with:
-
Hera is an example, http://www.babylonjs-playground.com/#1BKDEO#43 I created two worldspacecanvas named canv1 and canv2, In the beginning, canv2 is over can1, but canv2 will be under canv1 when canv2.position is reset. It happens on using FreeCamera, AcrRotateCamera is no problem. Is it a bug ? @Nockawa
-
Hi All, I want to move(Like animation without pressing keys) Freecamera in a uneven path (vector3 array). For ex: I think the same question has been asked in our forum by other people. and i searched in some of the threads and in BABYLONJS Animation tutorial also, but it was like Start point and end point.using animation we can move from one point to another point. i have implemented TweenLite for moving camera, it is working but the the movement is smooth . but i want to move camera automatically in a series of provided vectors(vectors array) like animation.
-
Hi, i don't know whether is this is a bug or not (or)i don't know whether other people experienced this behavior . when i press and hold back button while looking at ground the frecamera jumps into air and slowly it drops down. for example: take flat2009 look at ground . Click and hold back button camera jump sand touches the roof after that the camera start dropping slowly.
-
Hello, I want to make a target camera since 3d software with a aim constraint between camera and is target and animate . This camera rig is better for me to animate because i do not have to animate the rotations. To do this i use scene register before render like this: http://www.babylonjs-playground.com/#1ICOZQ#0 Do you know if he would have a better solution. Thanks
- 2 replies
-
- freecamera
- animation
-
(and 1 more)
Tagged with:
-
I have an application where I have an FPS like camera that moves around a scene. I want to be able to use a camTo function to move the player around the scene. I have a position v3 and target v3. If I do not have a rotation value, the camera is not looking at the target. Is there a way to calculate the rotation knowing the position of the camera and the position of the target. Is my approach to this incorrect? How do I correctly move my freecamera to the correct location and ensure that it is looking at my desired target?
- 6 replies
-
- freecamera
- rotation
-
(and 2 more)
Tagged with:
-
Hi, I'm trying to figure out how to rotate a FreeCamera on Z axis without using a handler. In this example http://www.babylonjs-playground.com/#1CEZ5W#0, I only can rotate the camera using the handler. You can comment/uncomment the rotation lines in the renderLoop in order to see the difference. Do you understand what I want to show ?
-
Hi, I am using Freecamera for my scene, i want to rotate ,i don`t want to move how can i restrict the movement only rotation has to work.
-
Can any help me ,how to make our FPS Camera (Free camera) to walk on steps