I'm trying to figure out Cinemachine to create some kind of Top view perspective. I managed to find the setting to make sure the camera keeps it's rotation, and follows the player. My issue now is that little extra movement that happens when the player is moving. Is there a way for me to get rid of it, so that my camera stays still?
What I have
Camera Settings
What I'm trying to achieve
Edit:
Edit after comment
Camera settings
You can set Body type to transposer and Binding Mode to world space:
Have you tried to change the aim setting to Do Nothing? If you leave it to Hard look at it will always keep your player at the center of the camera.
You can read the documentation here:
https://docs.unity3d.com/Packages/com.unity.cinemachine#2.6/manual/CinemachineVirtualCameraAim.html
Related
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.
I need a solution for my problem, please.
I make a character in unity 3d base on AR, the problem is when I build the project in my android phone I can found the character or I should to turn a camera for search where is he.
I need to make this object into the center of my camera how can I do this, please ...
The question isn't the clearest, but I suggest attaching the camera to the gameobject you want to see in the editor.
This link is to a unity tutorial.
https://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial/following-player-camera
Just re-read your question, AR skimed over that at first ... so you dont want to move the camera rather you want to move the object.
To find the middle of the screen in world space is what you asking for.
Camera.current.ViewportToWorldPoint(new Vector3(0.5f,0.5f, 100));
Use your camera to find a point in the world that is in the middle of your view. You have several options, ViewportToWorldPoint for example as shown above. ViewPort calls 0.5,0.5 the middle of the screen, Z is the distance from the Camera origin point.
You could alternativly cast a ray from your camera center screen and find a point on the ground to put your character at ... would need to know more about your wourld set up to help further.
My old answer is how to move a camera ... I will leave it case its useful to you.
[Edit Old Answer]
The other answer will work and is nice and light but has its limitations as your project advances.
I recomend Cinemachine for camera work, in this case a simple Cinemachine virtual camera setting its 'Look At' and optionaly its 'Follow' is what you want.
https://unity3d.com/learn/tutorials/topics/animation/using-cinemachine-getting-started
Cinemachine tutorail above. in short, Cinemachine works with the concept of 'virtual cameras' these are just light easy to use behvaiours that discribe how to 'frame' a shot e.g. what to look at, how to move, etc.
You real camera will get a Cinemachine 'brain' which simply listens to these virtual cameras and sorts out what to do to the real camera to make it happen. Getting to terms with this system will greatly improve your camera work and masivly simplify it.
Things like simply attaching the camera to the player object and similar work but have big limitations that end up biting you in the backside eventually.
Alternativly you can write a script to transform the camera based on your own custom logic the draw back here is the 'ball of code' problem ... that is at first the logic is simple but as you want more and more specific shots framed up it gets to being a spegettie monster quickly.
When the camera is obscured, the AR system loses track of the position of gameobjects and player should recalibrate the surface to make the game objects appear again.
Players can accidentally obscure the camera anytime, so this is not desirable.
Is there a way to prevent this from happening, so that the gameobjects reappear in their original positions after the camera is un-obscured?
Here's a video describing the issue
Thanks!
-Jake
I've never had this behavior, my guess is you need a larger space with more track-able distinguishable objects.
It's not got enough to to realise that it's looking back at the same place.
I can't move, rotate or scale Objects. Why is this?
Note: I am using Unity 4.
From the Screenshot you posted, you are clearly in Pan Mod:
You need to be in Move Mode to move Objects, Rotate Mode to rotate objects, Scale Mode to scale Objects and RectTransform Mode to modify Canvas and UI Object RectTransform.
Move Mode:
Rotate Mode:
Scale Mode:
RectTransform Scale Mode:
I also noticed that you only have the Game View. You should have both Game and Scene views. You need to be in the Scene View in order to move,rotate or scale an Object.
Reset your layout then you will have Scene View. You can use the image below to see how to do that.
You can find more about this here.
I came here from a similar, but different problem. Every time I clicked a tool, it would jump back to the the Pan tool. Couldn't even select the other tools and there were no tool widgets in the viewport.
Turns out it was because I was using ProBuilder add-on and had left it in edge mode rather than object mode. Switching back to object mode solved it immediately.
Just in case someone else comes here from the same frustration as me.
On my Mac, caps lock would prevent most drag features, including this.
Either press G, or click the 3D cube icon circled in the screenshot below:
I find that Unity always cancels the selection. I don't know why, but this always works for me.
My title might have actually been a bit misworded, as to be honest I'm not sure how to word it, but basically I'm making a game on Unity and I have my main scene and I am making a main menu however what I want to do is have a, I guess, camera slowly panning around the main scene as the background of the main menu. Not sure if I worded that right or what wording to actually type into Google to research it so I'm hoping you guys might be able to point me in the right direction.
Cheers guys,
Jason
As stromdotcom mentioned you can attach a script to the camera.
It's hard to tell what you're trying to do but if you want to circle the camera around a point...
Try making an empty game object in the middle of your scene and point the camera at it.
Make the object the parent of the camera (using the object and cameras transform properties).
From here you should be able to set the game object to rotate using a script, which should make the camera spin as it is a child of the object.
I have not tried this in Unity but I have used this technique in other programs so I'm assuming it will work. Sorry if it doesn't.
If your scene is already set up then you can attach a script to your camera which simply modifies the camera's transform to move it around the room. You can move and rotate the camera just like any other transform in your scene.
Im pretty sure what you are looking for is "Animation view". Unity has a tutorial on it: https://unity3d.com/learn/tutorials/topics/animation/animation-view?playlist=17099