Make character follow cursor movement and detect collision
Hi, I'm making a game which a blob character follows the mouse cursor. I used ray cast to detect whether the mouse ray hit the floor, then set the blob new position.
However, the blob does not collide with walls and obstacles but passes through them. I tried to ray cast with its movement direction to check if it hits a wall and clamp the new position to the impact point. It only works at certain motions. Otherwise, it snaps to the wall or still ignores them.
I found a post suggesting to apply the movement on a empty parent and use a spring joint on the child. I'm experimenting on that as well. Currently, the blob will still pass through the wall if the cursor is too far away from the colliding wall.
I'd love to know what directions I can do to improve my approaches? Or Are there other ways to make the character both follow cursor movement and detect collision?
Thank you in advance!
Your answer
Follow this Question
Related Questions
Recreating 'skin width' functionality on a rigidbody? 0 Answers
Ignored colliders still interfere with physics simulation. 1 Answer
Physics.BoxCast not returning a hit when scale too small 0 Answers
Input.GetKeyDown not reading? Am I being oblivious? 1 Answer
Start falling through ground in one frame and in the next frame everything is good. 0 Answers