I want to make snake to bounce off of wall, I need only to change direction. For example, if it hit left wall at 45deg going up it needs to rotate to the right for 90deg, and continue going up and right at 45deg angle (relative to wall). This must work for arbitrary wall angle.
Like this (+ is head, * is hit point, ! is wall, / is snake):
+ ! / !/ * !\ ! \
I’m moving snake head with translate forward, and make other parts follow it.
I’m trying to make it work by calculating reflect vector, but I don’t know how to rotate head in it’s direction.
Screenshot of progress so far: