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
Related
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
so trying to make this as simple as I possibly can (which is next to impossible)
so in the unity editor using the 2d platformer learning thing im trying to switch the player sprites with many sprite lists from https://aamatniekss.itch.io/fantasy-knight-free-pixelart-animated-character for the images I'm trying to make the images into a new sprite animation
I hope I made this straight forward enough.
Use this BRACKEYS TUTORIAL
You need to make sprite sheets or create the animations in the Unity animation system and then trigger them by code or state machine.
https://www.youtube.com/watch?v=87cF8jqVpBA
i found it myself so anyone who needs to know here you go
make sure the sprite isnt in single but multiple.
I am learning how to make games using unity, i have used free sprite packs from unity's store.
i have selected each individual sprite and changed its z position to 0, but when the game runs it looks completely different to how it looks in the editing window.
please help.
Here is a video I recorded.
https://youtu.be/2hb9m01PQBk
Are your sprites on a prefab, or children of another game object? The Transform of the parent object affects the transform of all children.
It looks like this is a camera problem. Your camera is set to perspective, it is possible to do parallax backgrounds with a perspective camera and you may have already accomodated for it, but that is the first thing I would check.
You can modify this by going to your Main Camera and selecting Orthographic from the Projection drop-down menu.
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.