unity camera should rotate around static point - unity3d

When I press the play button for preview, I want the camera to stay static (rotating around a static point) instread of moving around that point in a fixed radius.
I can't find the correct configuration - does anybody know the setting I have to do?

Create a camera object in unity editor (make sure there is only one camera at that depth level).
1.1. If you are using a different camera as well, then delete the audio listener component on the new camera.
Add MouseLook component to your camera (the script comes as default in unity).
2.2 If you cannot find the MouseLook script component, then go to Assets->Import Package -> Characters, and select MouseLook.
Your done, now when you press play you will be able to rotate around with your mouse, but the camera position will be static.

Related

How to move a GameObject with the camera when picked up in Unity 3D?

I am a newbie in Unity. I have searched on the internet for tutorials on how to pick up GameObjects and followed them as it is. But here's the problem:
This here is when I set the Camera as a parent to GameObject, initially....
And here's what happens when I move the camera.
The problem here is that the Object doesn't stay on the crosshair
This happens only when moving the camera along the Up-and-Down Axis (not sure if x or y).
However, this doesn't seem to be a problem in any tutorials. Is there any part of the code missing?
P.S:- I have set the Camera as a parent to the GameObject in the hierarchy directly without any code.
It is difficult to know the exact problem without at least a video of it, but the first thing here is to make sure there's nothing messing with the object's transform outside of camera's parenting.

Why does the camera in unity keep falling and losing track of player as if it had gravity enabled?

Hello I was trying to build my first 2D game using a video I saw on youtube. The thing is the camera keeps on moving downwards and away from the game character.
Create a new camera and make sure the view is on your player.
Go to Window -> Package Manager and search for Cinemachine.
Import Cinemachine Package.
Create new Cinemachine 2D camera and set it's Follow to your player gameObject.
More information would also help.

Unity Video Player

I am failing at playing a simple video under unity free 2017.1.0f3 personal
I am working on a game and I'd like to play an introduction video at the start of the app. Then move onto the login screen whenever the player clicks it.
I have created a video player object, dragged and dropped the video clip (mp4) into the video clip field of the object.
I then attached the object to the camera. In the script attached to the camera I created a public VideoPlayer that I have populated with the video player object.
I then execute :
void Awake ()
{
VideoPlayer.Play();
}
But nothing happens.
Perhaps it should be executed within a separate thread (coroutine)? I tried but did not work either.
Any help please?
Provided you filled the right settings, if it still doesn't play but you get no error, no freeze, no nothing.
Trying restarting Unity.
(I struggled for 45 min trying to figure out why my video wouldn't play anymore until I restarted Unity and it magically reworked)
did you check if the Video can be played back by unity?
put a quad in front of your camera, put a videocomponent on there, check Loop and playonAwake, hit Play and see if it works.
GameObjectWithPlayerComponentAttatched.GetComponent<VideoPlayer>().Play();
should work fine
Did you assign the RenderTexture?
What I do is create a RenderTexture, then assign it to the videoplayer, then add a Raw Image and then give it the RenderTexture in the Texture field.
You should uncheck play onAwake if you want to play it at a certain point, instead of videoplayer.Play, use videoPlayer.
Prepare and prepareCompleted Play the video.
Like this:
private void Start()
{
videoPlayer.prepareCompleted += VideoPlayer_prepareCompleted;
videoPlayer.Prepare();
}
private void VideoPlayer_prepareCompleted(VideoPlayer source)
{
videoPlayer.Play();
}
Video Player has three modes: Render Texture -- and then you need to select a RenderTexture to render to, Material Override -- and then it needs a mesh to write to its material, and Camera -- then you need to assign a camera and select to render to the near or far plane.
To have the camera feature work automatically, you need to instantiate the VideoPlayer script on the camera object itself.
Follow these steps to play a video using unity's VideoPlayer component:
Create a plane, under 3d Objects.
Add a VideoPlayer component to that plane.
Set render mode as Material Override.
Drag the mesh renderer component of the plane to the videoplayer's renderer field.
Select a video clip to play and enable play on awake.
Press play in the editor window.

Accessing Main Camera Left and Right in Unity / google-vr

This is a follow up to this question regarding how to display objects on one camera only in google-vr and unity.
In the current demo project of Unity and Google-vr, I can only access Main Camera Left and Main Camera Right while running the game. During runtime, I am able to disable a layer with the culling mask of one camera.
But I am not able to save those changes while running the game. If I stop, the two Main Cameras Left/Right disappear and I only see Main Camera and GvrReticle as child.
I suspect the cameras are created or imported from a prefab during runtime.
What would be the right way to have the left / right cameras accessible when not running the screne?
It's mentioned in the guide:
Often you will wish to add the stereo rig to your scene in the Editor rather than at runtime. This allows you to tweak the default parameters of the various scripts provided in this plugin, and provides a framework on which to add additional scripts and objects, such as 3D user interface elements.
To turn your Camera into a stereo camera, select the Camera (or Cameras) in the Hierarchy panel, then execute the main menu command Component > Google VR > Update Stereo Cameras.

Vuforia not showing what the webcam sees in Unity while still capturing the marker

I am making a first-person game using Unity and Vuforia. What I'm trying to achieve is that the user can have a marker attached on an object that can be held in his hand (a bottle, a book, or toy). So when he plays the game, he can hold the object in his hand, have the object facing the webcam, and move or rotate the object to control the first person character in Unity, e.g., tilt the marker-attached bottle in physical world so the first person character moves forward in Unity's virtual world. ps. by virtual world I mean just a basic first-person character walking around in a room, not the kind of VR that involves Oculus Rift.
I just played around with Vuforia. The good thing is I can choose my own image as the marker (looks like not every marker-based Unity plug-in can do this). But with Vuforia, can I create a virtual environment that's not showing the webcam's view? I did a basic Vuforia + Unity tutorial that only shows what the webcam captures and overlays a virtual cube on the detected marker. Summary of what I need is: not showing the webcam's view but still have the webcam functioning that it can capture the marker and I can use its position/rotation. In a way you can say I am just using the marker+webcam combo as a sensor used to control my virtual world activity.
Thanks!
From what I get it appears you want to use your marker as a target object to control motion in AR..
You'll have to build the functionality in Unity only as to what you want it to do specifically according to your set gameplay..
For example if you want a virtual dog to follow a target object, one easy way to do it is to provide an offset between the marker and the game Object and play a walking/running animation.
So it will appear as if the object is always following the marker, whereas in reality it is playing same animation at a constant distance.
As far as importing the marker is concerned.. It is no different than what you must have done with your cube..
In your Vuforia account Dev Portal:
Download the Vuforia SDK and import in your Unity asset folder.
Go to Liscense Manager under Develop tab and add a Liscense Key.
Now go to the Target Manager and add your images in the Databse which you want as target. (make sure the image quality is good for it to work prperly)
Now download the database and import it in your Assets folder in Unity.
Now go to your Liscense Manager again and copy your Liscense key and Open Vuforia Configuration under Vuforia Behaviour (Script) when you click on AR Camera, you'll find a dialog box there, paste this key there.
Save the build and run your game in Unity and bring the marker in front of the Webcam and it should work properly.
Hope this helps.