So I have a game that I'm working on and its a simple platformer kind of like mario bros, I have a simple physics engine to move the player (Things like gravity e.t.c), But I have no idea how I would go about stopping an objects movement on collision, the best I've managed to do is to stop all movement if it collides with an object, but it is still left intersecting the object and can not move at all as the movement script is just turned off at that point.
Any help with the theory or snippets of code would be appreciated :)
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 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 am currently working in a Unity 3D project (in version 5.0.1 to be precise) in which the character can walk in different-shaped planets without falling. So it is always attracted by the planets gravity (similar mechanic to the Super Mario Galaxy games).
Now, the problem is when I try to code the AI for the enemies. This AI should be pretty much simple, but because of this thing that I have with the planets shapes, I haven't been able to come up with a solution. The enemy should check where the player is and move ahead to its position. It's a really dumb enemy. But the thing is, that the enemy must be able to track the player and get to its position no matter what planet he is in. So, if the planet is circular, I cannot make the enemy look at the player and then move forward, as I would do in a plane planet.
I have already tried using a NavMesh, but Unity doesn't want to collaborate and ends up making a NavMesh of 1/3 of the planet. I don't understand why. I have tried changing every single parameter of the NavMesh baking but I haven't succeeded.
Another problem that I would like to do is: ¿How would you make a player be able to walk on the surface of any planet, no matter what its shape, in a smooth way while using a Mesh Collider? I am currently achieving this by getting the planet's normal with a raycast, rotating the player so that the Y axis is perpendicular to the normal and applying a force in -Y to simulate gravity. But this brings lots of problems when I implement the Mesh Collider. It results in a jittery effect. But, when I use a primitive collider from Unity, it works fine...
Anyway. What I need the most now is the answer to the AI question. The other one is kinda like a plus.
P.S: It doesn't matter if the solution is in Javascript. I can then translate it to C# :)
Anyone know how to use Goblin XNA to implement ball control in the same way as one might find in the board game labyrinth?
There don't appear to be any tutorials or information at all regarding how to do this, despite there being a demo video displaying just such a thing.
I've setup the environment and gravity and added the ground and a sphere. I use WorldTransformation.Decompose to extract the current orientation of the board. I know the next step will be either ApplyLinearVelocity or AddForce to the sphere based on the current board orientation, but I don't know how to constantly apply these methods to the ball so that the ball is moving in response to the movement of the ball. Adding code to the Draw or Update methods only executes the code a single time. Anyone familiar with Goblin XNA at all and able to help?
As far as I can see in Goblin XNA the Update and Draw methods are called the same way as standard XNA games. Can you give more specific information? source code perhaps?