In unity 5 I am having an issue with certain collisions. I made a basic maze-like game where the player controls a cube across platforms (made from other cubes). In certain areas, two or more of the platforms touch so the player can get to different areas of the level. The problem with my collision happens at these intersections. The player will seem to get stuck for no reason and they would have to back up and get a running start in order to get to the other platform. I went through everything and made sure they are lined up perfectly in the unity editor but nothing seems to fix this.
Any advice would be greatly appreciated .
EDIT: all of my objects are using box colliders
A common (and good) practice is to use a Circle collider on the bottom of your character object in conjunction with a Box collider.
For Example:
While this will likely fix your issue, the source of the problem is probably using many small tiled cubes each with their own colliders. A large amount of tiled objects with colliders most likely cause performance and collision issues.
Related
I am currently working on a 3d game in Unity, and I am working on the level design using ProBuilder. I basically created a huge cube which I "flipped normal", and a second one way smaller
which, as the other one, I flipped normal, but as soon as I crossed it while turning backward I could weirdly see through the small cube, which makes it feel unfinished. How could I fix this issue?
Normally in 3d games triangles can only be seen from one side. Usually this is not a problem because walls have some thickness. Since you clearly have paper thin walls made of only one layer of triangles this is exactly the result you should expect.
In short add the other side to your walls. The simples way is to duplicate the existing triangles and flipping them. Walls will still be paper thin of course. Later you should probably make them thicker.
I am using Cinemachine asset in my Unity project and is working fine without any lag. However, the places in my Scene which has a lot of ladders, are facing intense lag, making the game unplayable. Such a scene is shown below.
Reasons that I can think of the lag is too many collisions happening or the cinemachine(may be). Two images below show the physics shape of the ladder sprite.
My camera is set-up inside an empty gameobject called "Cameras" as shown below. The state driven camera utilizes the player animator which is shown in the second screenshot. I am afraid that I can not provide a minimal reproducible example in this case. Could someone help me by pointing in the right direction to fix the lag?
EDIT: Unity profile also suggests that Physics usage is consuming too much CPU with CinemachineBrain.AfterPhysics() and Physics2D.FindNewContacts being the major culprit:
EDIT 2: The ladder is created using a tilemap component as shown below:
Can you try simplifying the collider boxes for the ladder to a single box collider shape?
So I've hit a bit of an oddball in my project. I'm creating a horror scene. To support the atmosphere I've used Unity's lighting component fog. For my camera to see this fog, I need it to be on Forward rendering. However, I'm creating a hallway with different rooms and lights, and these lights seem to shine through my wall objects when forward rendering is off. Something I can fix by using deferred rendering instead (But then there's no fog).
It feels weird I'm in a position where I have to choose between the two and can't have it both ways. I tried messing around with some of the Legacy rendering, but no dice. All lights have a shadow strength of 1, and walls even have additional "Shadows only" walls, just to be sure nothing gets through.
It should be mentioned that I'm using one plane for all rooms (Not prefabs, one BIG object) if that has any impact at all.
Anyone experienced similar issues who has any workarounds?
If anyone runs into a similar issue, it's important to have different planes for different rooms. I was using 1 plane for the whole level, which caused this lighting bug to occur.
I had a similar problem... i solved with:
Set my camera rendering path with deferred
camera component
and set the component post process layer (asset)
post process layer
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.
I have a work-in-progress spaceship interior built with Unity (utilizing pre-built assets). It won't move much. The space around it will, similar to how I made an HTML/Three.js version of this concept (although linked example does move ship around space scene while scales are also animated).
With the three.js version, I was constantly fighting with "space" entering the ship; warp beams and planets colliding with the front info screen or passing through the chair (destroying the illusion of massive scale). I was able to resolve most issues, but it was a challenge when everything was in the same scene.
In Unity, is there a way to keep the ship scene separate from the surrounding space "scene", whether it is part of the same scene or in a separate one on another layer, or the same scene with masks that prevent overlap? I don't need a very literal answer, but any guidance that leads to a solution will be promptly accepted.
Yes, it's a very basic and useful aspect of Unity - the layers system.
As you guess you can find endless doco about it at Unity, cheers
Note too - Unity of course has superb occlusion culling built-in. Almost always this will "just work" for you.
Note that (if I read you right) you're doing a scene with a tremendous difference in scales (like "10 cm" objects AND "1000 km" objects at the same time). As you probably know you basically can't do this in a game engine, it's tricky to pull off.
Just BTW this is more a question for gamedev.com