Core Mechanics: Building the Answer Bubble
In Pippo Math, players interact with floating Answer Bubbles in an AR space. These bubbles display possible answers, and players must aim and select the correct one to solve the problem.
To create this mechanic, I designed a 3D Answer Bubble Prefab that dynamically spawns with each math problem. Here’s how I built it using Unity, C#, and TextMeshPro:
1. Creating the Answer Bubble Object
To start, I needed a simple, readable 3D object that players could interact with:
1. Create a sphere:
- Add 3D Object Sphere
- Scale it
2.
Add a Text Component for the Answer:
- Add Text
- Adjust its position so it’s clearly visible in front of the sphere.
- Set the font size for readability, align the text to center, and change to readable color.
2. Writing the Answer Bubble Script
- Setting up answer:
- Checking if the answer is correct:
- Destroying the bubble on interaction:
- Keeping the bubble in consistent position:
3. Turning the Answer Bubble into a Prefab
To easily reuse Answer Bubbles, I converted it into a reusable Prefab:
-
Drag AnswerBubble from the Hierarchy into the Project panel.
-
I deleted the original AnswerBubble from the scene, as the game dynamically spawns new ones.
Troubleshooting
While testing, I ran into a few issues that prevented the bubbles from appearing correctly. Here’s what I found and fixed:
1. Scale Issue:
- The Answer Bubbles were too large, making them appear off-screen or clipped by the camera.
- Solution: Resized the bubbles to around (0.5, 0.5, 0.5).
2. Missing Collider (Is Trigger):
- Without a collider, the bubbles couldn’t detect player interactions.
- Solution: Added a Sphere Collider and enabled "Is Trigger".
3. Layer Issue:
- The Answer Bubbles were accidentally set to the UI layer, preventing them from rendering properly in AR.
- Solution: Changed the layer to "Default" to ensure proper visibility.

Comments
Post a Comment