Question by
thecapitankaty · Feb 13 at 03:28 AM ·
collisioncollidercollision detection
Why Character is going through the floor.
Why Character is going through the floor the floor has a BoxCollider2D and a Rigidbody2D with Kinematic setting and the player has the same thing but with Dynamic instead of Kinematic the code for the player
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
[SerializeField]
KeyCode right;
[SerializeField]
KeyCode left;
[SerializeField]
Vector3 v3Force;
private void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "Ground") {
GetComponent<Rigidbody2D>().velocity = v3Force;
}
}
void Update()
{
}
}
Comment