Ground checking with a frequently rotating player

Hey yall

I’m new to the Unity interface and I’ve been working in 2D to create a demo for a game that includes being able to rotate the gravity field of the player. Basically the player has the option to rotate in 90 degree increments with the L/R buttons on the controller (like the game “And Yet it Moves”) and gravity is relative to which direction the sprite is facing. The player can jump and I’m looking for a way to set a ground check position.

Trig will work, but I’m wondering if there’s some other way that Unity can handle the situation. I drew a little picture:


I imagine that people making side-scrolling snowboarding games run into something similar. Setting the gC position to the parent’s transform.position.y - 3f or something like that doesn’t allow it to rotate freely with the parent. My idea right now is to get the angle via eulerAngles.w and draw up an equation that will give me the offset x and y components and I can set this gC point relative to the parent’s transform.

Is there an easier way to do this or is it soh cah toa time?

Make empty gameobject(gC point). Set your sprite as a child. Ajust sprite local position (legs should be at gC point). That’s pretty much it). All movement/rotation should be applyed to parent object. Spite will rotate correctly.

P.S. my engris suck)

What I ended up doing was setting a Raycast:

if (Physics2D.Raycast (new Vector2(transform.position.x,transform.position.y), -transform.up, 3.05f, 1 << LayerMask.NameToLayer ("Ground")) ) {
			IsGrounded = true;
		else {
			IsGrounded = false;

I was working with Linecast, which only lets you set a start and end position. With Raycast you can set a direction (-transform.up) and a distance which works perfectly for this example.