Unity2d; How to raise(lift) camera during game mode at a fixed y axis minimum - camera

I may be making this harder than what it really is, but I am also pretty new to developing games. Currently I am making a practice scene to get back used to the unity engine as I have not had time to use it since last summer. My issue is that I can not figure out how to lift the camera in game mode. Notice my photo below, and how much of the "underground" is showing. I want to raise the camera to keep it at the very least a specific y axis value, so that I can make less of the ground visible, and more of the background visible. If I am over complicating this, please also let me know. Thank you

If main camera is still then just lift the camera in scene view you can see changes in game view.
Or if camera moves with respect to player then you have to use a script and attach it to camera and get a reference of player transform in the script and according to the player position change position of the camera. Add an offset value in y component of the camera.

Related

Unreal Engine 4 minimum distance of camera from object

I placed a standard Camera in front of a moving Actor. When I set the current view to this camera I noticed a strange behaviour: If the actor get really close to another object on the scenario (a default cube) it disappear from the view. It looks like the camera is getting into the cube. I'm pretty sure the camera is not colliding with the cube because the actor has a couple of bumpers that prevent the side where the camera is placed to collide with other objects and the whole camera mesh is placed fully 'inside' the actor. The problem maybe is related with the size of the actor that's about 40cm x 30cm x 10cm. The observed cube is 1mt x 1mt x 1mt, the minimum distance of camera from cube is around 3 cm.
Sounds to me like you're experiencing an issue with an object passing your camera's "clipping plane." In the 3D world, this is simply just draw distance minimum and maximum values. For more information on what you are experiencing, check out this brilliant explanation by Autodesk: https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-Rendering/files/GUID-D69C23DA-ECFB-4D95-82F5-81118ED41C95-htm.html
Now, let's fix the issue! In Unreal Engine, it's super easy. Go into your Project Settings/General Settings. There is a value called Near Clip Plane, which simply changes the minimum clipping value for Camera components. I would bet making this value smaller will fix your issue! For a visual representation, check out this tutorial by Kyle Dail: https://www.youtube.com/watch?v=oO79qxNnOfU

Is there a way I can let the camera zoom but not rotate?

Is there a way I can let the SceneKit's camera zoom but not rotate? And how can I delimitate the maximum and minimum zoom the user can do with the camera?
It depends what you mean by zoom – if you mean to do the same thing as 'zooming' a camera lens, you want to modify the yFov and xFov (field of view) attributes of the SCNCamera object. The camera stays in the exact same location, but changes its field of view like a zoom lens.
I cannot see how you can rotate the camera while zooming it – I’d need to see more context of where you’re using the camera. If you don’t touch the SCNNode the camera is attached to, you can’t possibly rotate it.
You're talking about user camera movement with allowsCameraControl, right? I don't think that's really meant to be the basis for a sophisticated user camera movement scheme, more of a simple debugging aid. If you really want fine control over how the user can move the camera, you're best served by creating your own camera node and moving it / changing its properties in response to whatever user input you want to handle (gesture recognizers, game controllers, etc).
I suppose you might be able to constrain the automatic user camera by implementing a scene renderer delegate willRenderScene method. You'd have to get the current pointOfView node, check its position and camera parameters, and change them if they're outside whatever bounds you want. But A) I'm not sure this would work, and B) it's probably not a great idea — it's sort of like messing with the internal view hierarchy of a system control class.

Taking Control of ARCamera on Unity3D with Vuforia

The position and rotation of Vuforia's ARcam are determined by their algorithms to give the AR effect. I'd like to know how to do the following:
When some object is clicked the camera goes to some specific position (for that I need to somehow take control of the camera).
Also have to possibility to yield control of the camera back to Vuforia.
You'll want to use a second camera in this instance. Position the second camera at the AR Camera position, then adjust the depths to make the new camera the view that you see. Then you can tween its position to the predefined one you have.
Do the reverse to get control back to the AR Camera.

Unity automatically rotate camera on slopes up/down

I have a Player in first person walking around on Unity terrain and I'd like to restrict the camera controls to the y axis (left/right) and automate the camera rotation of the x axis.
So looking up/down should require no player input, depending on wether you walk up a slope or down.
I'm not quite sure what to look for. You could probably do it with a Raycast, but I suppose there's an easier way?
There are a few built in camera scripts. you need to import that standard assets that unity has. And there are a few different ones that you could modify, but they do follow the player very well.

Three.js 3rd person camera

I'm trying to create a 3rd person camera view in three.js
I'm using the THREE.FirstPersonControls(); on my camera. Then setting the rotation and positions of my "player" objects to be the same as the camera with some offsets.
This does not seem to work.
What i'm more wondering is if I should be adding my FirstPersonControls to the camera and then rendering the "player" infront of it. Or adding the controls to the player then making the camera always point at the back of the player?
EDIT:
I've tried setting the player object to be a sub object of the camera using camera.add(player);
but moving the camera around is not moving the player. I thought adding an child element would mean they move together?
EDIT 2:
I took another approach of adding both the camera and the player to a group then adding my 1st person controls to that group... Now both the camera and the player do get rendered. But it's completely thrown off how the first person controls worked. (e.g. looking down goes left etc etc)
Thanks for any help,
James
First of all, the Controls were designed to be controlling a camera, and not an object. And since by default, objects look "up" the z-axis, and cameras look "down" the z-axis, it is unlikely that the Controls will work as expected when applied to something other than a camera.
Secondly, the Controls are part of the examples, and not the library, so they are not officially supported. You are free to hack away at them.
One way to achieve what you want is to make the camera a child of your player. Something like this:
player.add( camera );
camera.position.set( 0, 50, 100 );
You may, in your render loop, need to set:
camera.lookAt( player.position );
Then you want to control the player with the mouse or keyboard. Your best bet is to write your own controller to do that. There are plenty of examples on the net.