The red means that it is colliding and the blue means that it is not hitting anything.
Hello, I have a simple ray being cast from a Rigid Body being used for the player (I did this so that I could add mass to the player) and when the player rotates the ray doesn’t collide with objects.
It does not happen when the friction is all the way down and the player is not rolling, but I would prefer to have friction in my game.
When it is at low friction, it will start to slowly roll and it still works. However, it starts to roll faster and does not work any longer.
This video is video is where the player has 0.05 friction. It is set this low because a higher fictions, it is hard to tell at what point the collision stops working.
1.The ray is the Shooting_Range object the only code in it is to follow the mouse and detect collisions.
2.This is the player and it doesn’t have much on it.
3.The platform is just a StaticBody2D with a CollisionShape and a ColorRect.
By collision not working, I mean the ray is not colliding with the platform even though it passes through it.
I have tried changing the location of the ray relative to the player, changing it to its own scene, changing the length, and messing with all the collision settings. But the only thing that worked was turning of the rotation for the player, and I do not wish to do that.
I found an actual solution. I made a new parent node for my player as a Node2D with the player’s body as a child and the raycast as a separate child. The collision was probably not updating since the raycast had to constantly fight the rotation of the player body since it was a child of it. That somehow put the actual collision detection at a lower priority.