- Home /
my thing keeps going through walls, but ridged bodies can touch the collider
i have a star fox inspired space ship game i have my ship broken into 2 parts, the ship and its ridged body/collider and a capsule. the capsule should stop the player going through walls and the mesh collider is to recognize the player touching the walls. however for some reason the player is able to go through the walls. to test the capsule was working i dropped a ridged body square on it and it reacted how is should react. i dont know what the issue might be and its really irritating! it might be somthing to do with my code but i personally doubt that as i dont think anything in my code comprimises the collision
float horizontal = Input.GetAxis("Horizontal"); // get horizontal and vertical so i can just reffer to horizontal and vertical for moviement
float vertical = Input.GetAxis("Vertical");
Vector3 direction = new Vector3(horizontal, vertical, 0.00f); //sets up the movement
Vector3 finalDirection = new Vector3(horizontal, vertical, 1.00f); // a little bit further out than direction used for the rotation
transform.position += direction * movementSpeed * Time.deltaTime; //movement
/* the ammound of rotation */ /*speed of rotation*/
transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(finalDirection), Mathf.Deg2Rad * 90.0f); //rotates the thing where its supposed to go
could someone with more knowledge help
Your answer
Follow this Question
Related Questions
OnCollisionEnter being called without the colliders actually colliding 1 Answer
Trying to make object turn red OnTriggerEnter 0 Answers
2D collision won't work? 2 Answers
Collision detection when no collision happens,OnCollision is called without a collision 1 Answer
What else is to be done if players falls through the floor? 0 Answers