Hello, so I have created a kind of 2.5D game. The character is a sprite, but everything else is 3D. How I have done this is by creating a GameObject, and I added a Rigidbody, the Movement Script, and a Capsule Collider. I created a GameObject inside the main one and put the Sprites and Animation.
All 3D objects have a Box Collider and that’s it. The problem is when I walk into an object, my character clips in and out of the object until I stop holding down the button. I have a feeling this might be a problem with my code, so here it is just in case.
public class PlayerLogic : MonoBehaviour {
public float playerSpeed = 1.0f;
void Start () {
}
void Update () {
playerMoveMent ();
}
void playerMoveMent(){
if (Input.GetKey (KeyCode.W)) {
transform.Translate (0, 0, -playerSpeed);
}
if (Input.GetKey (KeyCode.A)) {
transform.Translate (playerSpeed, 0, 0);
}
if (Input.GetKey (KeyCode.S)) {
transform.Translate (0, 0, playerSpeed);
}
if (Input.GetKey (KeyCode.D)) {
transform.Translate (-playerSpeed, 0, 0);
}
}
}
Thanks in advance.