Development Updates this week
Fixed the Collision Error when player is at the back of objects
I realized the error was not because of the ray origin position with respect to the camera, it was because my collision function for detected hit only sends the player to one direction after getting hit. So when the player is at the back of the object, the collision function sends it to transform.forward as when the player is at the front of the object.
void RayMarch(Transform[] ro)
{
int nrHits = 0;
for (int i = 0; i < ro.Length; i++)
{
Vector3 p = ro[i].position;
//check hit
float d = DistanceField(p);
if (d < 0) //hit
{
//Debug.Log("hit" + i);
nrHits++;
//collision
if(ro[i].tag == "Back")
{
transform.Translate(ro[i].forward * -d * 1.5f);
}
else
{
transform.Translate(ro[i].forward * d * 1.5f, Space.World);
}
}
}
}
So I resolved this by tagging all the collider transforms located at the back of the player as “Back”, and when these colliders are hit, the function goes into a different transform position function.
Polished Player Avatar
I found a cute free astronaut avatar asset from Unity Asset Store, and used it as the player. So now I’m planning to focus the theme on an astronaut exploring a new world.
Exploring Game Mechanics
Current idea:
A 3D puzzle-solving platformer where the player controls the fourth dimension by pressing the spacebar while using WASD to control the position and rotation of the fourth dimension in order to solve obstacles and go to the next level.
Then I build a simple level to test this mechanic: the player is trapped in a 4D garden and tries to escape.
Some thoughts for future development:
1. How to make this mechanic interesting and engaging with the puzzle solving genre?
2. More interesting level design using 4D shapes
3. Since the distance function only provides some basic shapes, probably adding more complex 4D shapes will make this more interesting.
4. Complete the game loop.
Objectives for next week
1. I will build more levels and come up with more puzzles.
2. I will also iterate the current game design based on my reflection for the current development and playtest feedback.
Reference
1. Astronaut avatar asset: https://assetstore.unity.com/packages/3d/characters/humanoids/sci-fi/stylized-astronaut-114298
Comments