unity3d - Camera jittering? - unity3d

For some reason when I run my game the camera which follows the player has a slight jitter to it. If I watch the transform the Y position values are fluxuating and the rotation is affected aswell. I can not think of any reason for this to be happening other than maybe having more than one camera as my water comes with a 'reflection camera'. I am using basic unity packages, and even when rewriting the camera follow script, the problem still occurs.
I know there is not much to go on here, as the code is minimal for this issue(using 3rd person controller and camera components). I hope someone has had this error in the past and fixed it or knows enough about unity to help me out here because im lost.
Much appreciated
EDIT
Dont know if animations could be effecting it but I thought id mention my model has animations

To resolve your problem. Click Assets->Import Package-> Characters Uncheck everything Execpt. SmoothFollow.
Drag Smooth Follow to your Camera. Drag your Character to the Target from Smooth Follow Script.
If this doesn't fix the issue. Try to remove your own script.

Related

Strange Unity tilemap issue

This issue is a little hard to explain, my first time creating a tilemap in Unity and when I ran the program to test out the camera position on the map, my tilemap converted into whatever this mess is. I don't exactly know what happened but I can't seem to revert it back to how it was, if anyone could help me they'd be a total lifesaver.
Did you check the camera size? If the image looks like a low res version of your tilemap than change the size to 1.

How do I add camera rotation in Unity

I am new to unity and I'm trying to figure out how to rotate the main camera from one position (in perspective of a person). I've tried looking for scripts and writing out but it never works.
here's what the scripts would look like...
enter image description here
I honestly don't know what I am doing so if this is actually a simple problem to solve, please don't be too harsh. Or do.
I am using unity 2018, btw.
Get the standard assets, use and look into the FPS Controller.

How I fix my character into center of camera with unity 3d

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.

How to ensure sprites face the correct direction at all times in a 2D top down game. (logic)

I am making a multiplayer top down 2D game with 3d elements. All my movement, healthbars and basic functionality is working flawlessly even while hosted and playing on a server, node.js socket.io. However In this game it is possible to move the camera like in Realm of the mad god.
in case you are in doubt here is a video: https://youtu.be/4tdcxl3aZ0c?t=31s
This of course means that the players can end up being upside down with regards to each other and I cannot find a solution that works in all regards to make sure the sprites of the other players are always facing the correct direction with regards to their movement.
I have made several solution to this problem which cover most scenarios but while play testing other things we always end up noticing that the sprites sometimes face the wrong directions. So I am wondering if anyone has an answer, the logic, the fixing this problem.
Things I have tried:
Adding a gameobject to the camera to which all sprites asses their change in distance and determine their facing direction based off that information. (this leads to the players sometimes flipping erratically when the camera is moved and they as well are moving as sometimes they may be moving slower and there although moving left the camera approaches from the right and that flips them)
Adding a gameobject to the world which allows all sprites to have a fixed point to which they can measure their change in distance and therefore also know what direction to face (this worked somewhat better as they always know what direction they have to face, however once the player is upside down everything is inverted)
Emitting to the other players wether I am upside down or not in order to try to reinvert the above solution in the case I am upside down. (I could not find a good way to do this, and it got me thinking that this must be a problem people have fixed before many times and perhaps someone know of a good solution that works.)
thank you all for your input.
I seem to have found a solution for this issue that works decently well. Keeping in mind that I do not want to have the server being involved in this and I would rather have each individual sprite know its direction rather that have something heavy trying to determine this logic I came up with the following solution. May not be the best but it works. Still very keen to hear other solutions.
On my main character I have a switch case, which changes depending on the players rotation in the world. I need this switch case anyway for fixing (http://answers.unity3d.com/questions/1348301/trying-to-change-the-cameratransparencysortaxis-to.html?childToView=1348316#answer-1348316) that issue.
As the cases change I simply place the gameobject that I want the sprites to compare their distance to at 1 of 4 positions. YPos, YNeg, XPos, XNeg. Meaning that the sprite now determines its facing direction based on a gameobject that is placed in accordance with the Players position. without having to place it on the camera.
I will update if during further play tests this gives me trouble but thus far it works in the all the cases I need it to.
Still very willing to hear other solutions to this problem.
Thank you.

Curled fingers: Unity3d

When I played imported animation, the character's fingers get curled and his mouth opened. I might be able to fix that by editing adjusting bones in unity. But with so many characters and each time dragging them from assets to scene.
It's a bit too much misery and it's slowed me down, I need this get done fast.
Unity Masters, PLEASE HELP ME.
the bones in your imported model rig must contain all the fingers and other parts bones that doesnt move correctly , if it does then assign them to your avatar as you are setting up your avatar (look here for avatar setup) , after that if your animation animates fingers then your model will also
So that's right you don't get timely help. AnyWays,
[SOLUTION]
The animations was imported from iClone 5. Now I was importing animation separately and then applying it to the .fbx character. So I alternatively imported the animations embedded with the character. Now this is helpful only in case the original character is also being imported from iClone. Then in the rigged configuration I reset the pose>Enforce T-pose>automap> again automap>enforce T-Pose. Worked for me.
[SOLUTION2]
I had alternative in which I could mask hand animations (not using them) and remove jaw from 3d exchange while exporting fbx. But they looked so lovely I had to look further.
Sometimes you can't find the solution, I guess you are the only solution then. That's how everybody learns. hopes it helps.