-1

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.

Joetjah
  • 6,292
  • 8
  • 55
  • 90
RakeshChatra
  • 105
  • 1
  • 4
  • 9

1 Answers1

0

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.

Joetjah
  • 6,292
  • 8
  • 55
  • 90