Hi, I have a game idea, where I want a player to be able to walk on a certain shape called a mobius band (Sorry I can't attach a picture, please look it up, and you will have a much better idea what I mean, thanks).
My solution is to align the player's rotation with that of the surface below it (and this would have to occur in an Update function as the surface is constantly changing). By doing this, when a force is added the player should follow the curved surface.
This is my current code (contained within the FixedUpdate() function):
if (Physics.Raycast (transform.position, -transform.up, out hit)) {
transform.rotation = Quaternion.FromToRotation (Vector3.up, hit.normal);
}
The problem is, is that this code only aligns the player's x and z axes, as a result, when the player is given a velocity, it doesn't follow the curved shape, but instead just goes in a straight line.
So, an idea is that I may need to access the y axis of the ground below my player, and make my player's y axis match that, and that may solve the problem.
Any help or ideas would be greatly appreciated, thank you :)
↧