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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top