Spritekit physics failing to detect second adjacent item - swift

Kinda what the title says, I have a "wall" made out of multiple segments specifically for modular purposes. I have a contactTestBitmask that forces the player to stop moving in the direction of the wall once collided, but, if you slide along the wall to another segment, the player just rolls straight through it. I cannot do a collisionBitmask as the player runs fast enough to "phase" through the walls. I also cannot do collision as my camera and lighting are also dependent on the player's movement and position, and will not interfere with the walls (I think). If anyone could help point me in the right direction to allow me to make solid modular walls, I'd greatly appreciate it.

Figured out the source of my problem, contact IS happening, I just have wonky flags and the system doesn't like that. I need a contact currently happening method, I guess

Related

Objects not colliding Unity2D

I am trying to make a Retro Tenis Game in Unity2D but I have some issues with the colliding system.
My controller does not collide with the walls. It goes through them.
It should stop in the wall like pic1 but it goes through it like pic2.
Can anyone help me, please?
pic1
pic2
UPDATE#1: I added a RigidBody component but it does not fix it. (pic3)
pic3
You shouldn't use the colliding system for this purpose. It would be much better that the script in charge of moving your paddle was able to control its maximum and minimum height too (note that the screen size can change, and the paddles should move at different heights depending on the screen size).
Although if you want to do it with the collision system and "walls" that limit the space of the paddles, both the "walls" and the paddles need to have a correctly positioned BoxCollider2D and the paddles an extra kinematic Rigidbody2D too (as they can move).
Also make sure to move the paddles using physics and not modifying its position with transform.position (see Rigidbody2D.MovePosition)
Edit: Unity2D physics system is rather a complicated topic and difficult to get it well on your own. I'd suggest to learn the basics in the Unity Learning Platform. You could start with this project.
You need add RigidBody2D to your "circle"

Setting up a sliding character in the right way

I would like to try and make a game similar to Altos Adventure. I am having trouble starting.
How to set up the terrain so that my character doesnt get stuck?
I simply drew a test sprite for the ground in photoshop. What collider2d should I use?
I use polygon collider and reduce friction in the material. But the character gets stuck, hits small invisible bumbs and it feels awful. The worst part is connecting 2 ground sprites together! The point where they connect is always messy.
I have a question for the future as well. How would I add the endless part of the game?
Would having many "pieces" set up and just spawning them as the player rides down work?
I havent written any code yet as the problem is simply in the physics in my opinion.
Thanks to anyone who takes the time and tries to help!
To move your player use rigid body.AddForce(Vector3 direction, ForceMode forceMode); then create a Physics Material with friction = 0 and put it in your player's collider.

Unity Brick Breaker: Ball hitting in-between two bricks

I am making a 2D Brick Breaker game in Unity.
I have an issue with the scenario when ball hits in between two bricks. I have BoxCollider2D attached to all bricks and a CircleCollider2D attached to the ball. When the ball hits between 2 adjacent bricks, it bounces back in the same direction as if it hit the edge of the brick. There is no edge in between, but two adjacent bricks form a continuous surface. So, the ball should bounce off of the surface (in other direction) instead of bouncing back.
Anyone knows of any solution to tackle this problem? I asked this in the Unity Physics forums but didn't get any answer, so checking if anywhere here might have had this issue.
Thanks,
Mukul
I am guessing this could be the problem:
When your ball is hitting the bricks with a strong force, There is a chance it might move one of the bricks by a very very slight distance, even if the mass of the brick is much heavier.
This movement might cause an uneven surface, which is why the ball bounces back in the same direction.
Try adding a Rigidbody Component on every brick (if you have not done it already), and set its isKinematic property to true.
Let me know if this solves it.
Way 1:
Use one box collider for the wall, but not for every single brick.
This will fix your issue + will optimize your project.
Way 2:
You need to build wall programmaly and colliders in this case must be without spaces between them. This must fix the issue.
Way 3:
Make your own hitting wall logic.
OnColliderEnter you need to get balls velocity.
OnColliderEnd you need to set manually velocity.

How to change the shooting accuracy?

I am making an FPS game using unity 3d, I've a problem in the shooting accuracy script. Can you tell me how I can change it with a single script that shoot the bullet and include the shooting accuracy and equipped to the gun, please?
If you are currently using a raycast, you should have no problem.
If you are spawning a sphere and thrusting it forwards, I suggest you use a raycast.
Raycasts go in a completely straight line. Bullets follow gravity, and quickly fall to the ground.
You don't see bullets, they move too fast. Raycasts are invisible.
When it hits something, it sends you back the information you need. If you make the sphere go too fast, it might glitch through objects.
You can learn about raycasts here.

Enemy's parts are visible through the walls in Unity 3D

I have a location consisting of several connected rooms and some enemies chasing me. But when bots are walking very close to walls I can see their hands passing through the walls, despite both bots and walls have colliders and enemies cannot go through them. Is there any way I can create a border or something to prevent it?
It sounds like #Heisenbug is probably correct.
I would attach a secondary collider to your model, most likely a box (for speedy processing) and call it personal_space. This way you can control how much space they give themselves from walls and such while still allowing them to get closer to the player and other special objects.