I am following Aiden is All Knowing's Multiplayer FPS tutorial and can't seem to solve this issue.
I have copied and pasted the exact code he use in the video (https://www.youtube.com/watch?v=kTzR3ypM_Qc).
When I launch the game everything works fine but when the second player joins problems arise. When one player moves the other moves instead of it and when one player shoots the other the player who fired the weapon receives the damage and the second player does not have the fps cam activated!!!
I have put the character prefab in the correct place btw. AND THERE IS NO ERRORS!
Sorry if the answer is blatantly obvious or in the video, I have spent 5+ hours trying to fix this. :(
Player Inspector
Fixed It! I had a camera enabled when it shouldn't have been so.
Related
I am using cinemachine to make a camera that follows the player in a 2D top-down game. The problem is that pieces of the background disappear and reappear when the player moves, and some of the outlines of objects seem to render late in comparison to the rest of the level. Below is a link to the video showing the error. If anyone could help it would be greatly appreciated.
https://youtu.be/BiEojQQGFn8
Why my player lagging? I mean he is moving with 2 fps for enemy. Example: Player1 moves, in his screen all is ok. But player2 see player1 with 2 fps. And the same with player1.
Here is my prefab, and yes, I can't use RigidBody Transform
I think you could find the answer with very little research. The answer is quite simple though.
The reason why it's working perfectly on the client which owns the networking transform is because his input is directly reported to the game. On the other hand, the 2nd player has to send the information about his position to the host or simply the other players. The information is only sent a couple times per seconds.
You could increase the message sending rate of the networking but that's not really a good option. The best option would be to smooth the player's movement by assuming where he is going to be or move the player after it has moved already.
Here is a link about it : https://www.youtube.com/watch?v=Glm0nJ4sO5E
Basically, I noticed that for some reason, no collision was registered by OnCollisionEnter2D when a player jumped on a platform, even though the player seemed to be standing...From far away the player seems to be colliding...(The white rectangle is the platform)
But when we take a closer look, he actually isn't, even though the player isn't falling anymore : .
This happens, even though the player falls down from a height ; he seemed to have collided (he stops) but tge OnCollisionEnter2Dmetjod, doesn't detect anything, and with a closer look, the player isn't actually touching... Video of that happenning : (https://imgur.com/a/yT8KIzw)
Thank you to everyone to answers :)
I ACCIDENTALLY programmed this function (it was just 2 lines or so) a few days ago to orbit the camera around the player with the mouse x input value, but now I just can't get it to work again. I saw many solutions, some even used LookAt, but my own function was really very simply.
My player is constructed like this:
PlayerObject
CharacterWithBones (child of PlayerObject)
OverShoulderCamera (child of PlayerObject)
Could somebody tell me again how to orbit the mouse around the player so that the camera always faces the player?
I do swear that it was without LookAt, and it was really simple. But now all solutions that I can think of would be overkills.
Thank you for the help.
I was following a tutorial on how to create a simple game called pong. As I was working on it. I stumbled on a bug that when the ball is to fast it will it passes through the paddle without colliding with the collider
As you can see in the screenshot
Is this some kind of a bug in unity? I need to get rid of this and don't want to have this in my game.
by the way this was the tutorial I was following . Brackeys
What do you mean by 'bypass the player control'? Do you mean it passes through the paddle without colliding with the collider, even though it should? Or does it get stuck? The screenshot makes it difficult to tell.
Either way, the first thing you're going to want to try is changing the collision detection setting of your Rigidbody2D component from 'Discrete' (the default value) to 'Continuous' or 'Continuous Dynamic'. Fixing this sort of issue (collision errors for fast-moving objects) is exactly what those options are for.
Source: http://docs.unity3d.com/Manual/class-Rigidbody.html