I don't know why you want to use Raycasting when you try to detect a collision. You have the OnCollisionEnter()
and the OnTriggerEnter()
methods. These detect when you collide with an other object. When that happens, you can set the position of your Player-object.
Using raycast how to make player run between two colliders without colliding in unity3d? [closed]
-
23-03-2022 - |
Question
I am trying to let the player run on a path between two colliders on either sides using the accelerometer. I want my player to come back to the center after colliding with the sidewalls when I tilt the device.
I have tried using Raycast, but I am not getting it.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow