I am working on a maze game where the user finds the way to the door (or something). I have designed the maze in blender. Inside Unity, I imported the maze as custom asset. The cube which is the player in my game goes through the walls. I have added RigidBody to the player so that I can move the player using rigidBody.AddForce() method in C#. I have also added Box Collider to the player. How do I prevent moving through parts of custom assets (Walls in my situation)?
Related
hi i was making a multiplayer game where at some point the bullet was colliding with the sender and i don't want that. It keeps making glitches and the bullet keeps floating. I even tried reducing the player box collider but its still getting stuck. if i disable collision detection for the player and the bullet, the multiplayer version will be affected and players won't be dying
Please help
tried to reduce the player collider but when the bullet is shot on y axis its getting stuck
Since you're doing a multiplayer game, On the client side you could change the player's object layer to something unique. In my case here, I've added a new layer called Player and I'm instantiating my player on a layer called Enemy by default. I'm also putting my bullets on a layer called Bullet.
Make sure you only change the layer from Enemy to Player on the client side at runtime and for your client's player object only.
Then you can go into Edit/Project Settings/Physics and scroll down to the bottom until you find a collision truth table.
Then ensure that you uncheck the collisions between your player's layer and bullet's layer.
I'm using empty Gameobject(Prefab) as a player to instantiate it as a player on the photon server after that i'm using ReadyPlayerMe webgl plugin to load the avatar into the game at the runtime and making it child of PlayerPrefab.. however Photon can detect its position and rotation. but i can't see on other player's screen.
is it possible to load any random object at runtime and show it to all players.. like ReadyPlayerMe avatar
I am new to this and my game consist of a wide cube and a ball, the ball rolls on the cube platform like a ball in maze game. the ball drops trough the platform when i tilt to fast.(not that fast even). i tried multiple settings on the rigid body component and nothing worked. any pointers?
Might be wrong but from what I know when solving collisions Unity assumes everything has RigidBody or doesn't move, I assume only a ball in your project has rigidbody, but both ball and cube can have their position/rotation changed from script so what I suggest is to attach rigidbody to the cube and set it to kinematic so it won't move on its own and then move it via RigidBody.MoveRotation method to make sure collision is detected.
I'm currently developing a game with unity3d (2019.3 version).
My problem actually, is that I don't know how to make two colliders don't collide with each other, but still be able to interact.
Okay, let's have an example.
Let's say that I have a zombie and a player, I want the player going through the zombie, but i want the collider of the player able of being detected by the one on the zombie, so the the zombie can attack the player, same for the bullets that the player shoot on the player. (little precision, the zombie attack the player thanks to a trigger collider in front of him).
I've already tried to modify things in the layer collision matrix, but the player and zombie aren't able to interact. So that's not good.
If you want the colliders to detect eachother but not collide then you should probably set one of the colliders to be a trigger.
Just check the Is Trigger checkbox and that should help you achieve the desired result.
I would like to add multiplayer to my game. I use UMA (https://www.assetstore.unity3d.com/en/#!/content/13930) to generate a character in a character creation scene. I then use:
DontDestroyOnLoad(characterController);
To take the player to my main game scene. The UMA generated player cannot be made a prefab, cannot be duplicated or instantiated (not sure why but it doesn't work). So I then via script move the player to the spawn position where they can play the game.
I have made multiplayer games before, but in all of them I use
Network.Instantiate(playerPrefab);
to add the player to the game. The problem here is that I have no idea (nor could I find out online) how to implement multiplayer with a character ALREADY in the scene.
Any help, ideas, advice or suggestions would help me out a lot!
You can instantiate only the GameObject that has the scripts to control the player and search for the models generated by UMA which are already in the scene.
By the way, if you're using Unity 5.1 or newer Network.Instantiate is not used anymore. http://docs.unity3d.com/Manual/net-NetworkInstantiate.html