I cant get Unity Colliers to work!!!
I have a tank and a map for the tank to stay inside. The tank is a prefab and has a Script, Network View, Rigidbody 2D and A Box Collider. I have an empty game object with a box collider around a wall and the tank goes straight through the wall/Box Collider. I have spent hours searching the internet and have not been able to fix it. All help would be appreciated.
I am using the below command to move: transform.Translate(-Vector3.left playerSpeed Time.deltaTime);
Answer by MelvMay · Apr 09, 2016 at 08:36 AM
I would recommend following some of the basic tutorials on physics here.
You add the Rigidbody2D to ask it to modify the Transform component to the physics position. By modifying the Transform component yourself, you are doing the opposite; driving the Transform position which drives the Rigidbody2D position.
Answer by $$anonymous$$ · Apr 09, 2016 at 08:50 AM
@MelvMay What Command should I be using to move the tank?
Try using Rigidbody2D.$$anonymous$$ovePosition. Note that this moves the Rigidbody2D during the next fixed-update.
Also, physics uses layers to control what can collide with what. You can find more information about this in the tutorials and in the manual here.
Your answer
Follow this Question
Related Questions
All colliders not longer working 0 Answers
crouch attack collider 2d question 1 Answer
How to prevent a 2D Kinematic asset passing through a 2D Box Collider. 1 Answer
Stucking with RTS Building detection using 2D Raycasts and 2DBoxColliders 0 Answers
Player and tree collide with eachother, but too soon, the green colliders dont hit eachother 1 Answer