IN a platformer, I want to make a character walk up a curve. I want the character to change rotation when moving up that curve. The character is a kinematic collision object.
For example, sonic games have sonic rotate on a loop
I need to find the angle at which the object collides with the ground first. And then I can do that
Or something else that ensures that detects that the slope at the midpoint of the bottom of the character is parallel to the slope of the ground below. At least that’s what I think I need in order to do this.
Exactly. Rotating the player sprite to match the orientation of the normal should do the trick; but remember, there are edge cases - in some weird situations / exceptions you might want to handle rotation differently. Best of luck @SN_Trett, manual physics controllers are tricky to work with.
To start, I’ve added this line upon a collision response, but this syntax might be wrong. It should set the rotation of the game object to a new quaternion, made from the normal.
I am not really sure how to work with quaternions as a newbie, so is this right?
Otherwise, how would I create a new quaternion with the vector3 of the normal?
Also, should a main camera be a child of a character object, which adjusts once the character rotates,
or a separate entity, that is fixed in rotation, and sets its position to a character’s at every frame?
Try that. You might need to add 3.14159 to the math.atan2 to flip the sprite around, but that should work as a starting point. Keep in mind that angles for game objects are done in radians, not degrees - objects use radians and the gui uses degrees last time I checked, which leads to some confusion.
This depends. It is convenient to have the camera attached to the player collection, since you get all of the camera movement for free, but if you want a camera with a more advanced behaviour, perhaps with a camera window or some kind of snapping it might be better to have it as a separate game object and update it every frame. A colleague shared this excellent article on cameras today: Game Platforms recent news | Game Developer