Welcome to the Enchanted Village! đģâ¨



Nestled in a lush, green valley surrounded by rolling hills and sparkling streams, the Enchanted Village is a whimsical paradise where joy and harmony flourish. The villagers live simple, happy lives, growing their own food in sunlit fields filled with golden wheat, vibrant flowers đˇ, and juicy orchards đ. Every day is filled with laughter, music đļ, and the warm glow of community spirit.


At the edge of this magical land lies the Mushroom Village đ, home to the delightful Mushroom People! These tiny, cheerful beings live in cozy mushroom-shaped houses and spend their days crafting beautiful trinkets, dancing under the moonlight đ, and sharing their wisdom with curious visitors.



But not all is peaceful... Far to the icy north âī¸, banished to the snowy Arctic, lives the Wicked Witch đ§ââī¸. Her heart, as cold as the tundra, holds a grudge against the village for casting her out long ago. While the villagers whisper tales of her dark magic, they remain unshaken, knowing that the warmth of their unity and the courage of their Mushroom allies will always protect their enchanted home

Explore the enchantment, uncover secrets, and immerse yourself in this magical VR world! đ

Core Functionality
Keyboard Movement (WASD/Arrow Keys): đŽ
- The player can move forward/backward (W/S or âŦī¸âŦī¸ Arrow Keys) and strafe left/right (A/D or âŦ
ī¸âĄī¸ Arrow Keys).
- The movement direction is calculated using the player's forward đ§ and right âī¸ vectors, multiplied by the movement speed đ (moveSpeed) and frame time âŗ (Time.deltaTime).
Mouse Horizontal Rotation (Y-axis): đąī¸âĒī¸
- Moving the mouse horizontally rotates the player object around its Y-axis đ.
- Mouse X input determines how much the player rotates horizontally based on mouseSensitivity đī¸.
Keyboard Horizontal Rotation (Y-axis): đâ¨ī¸
- Left and right rotations can also be controlled using the A/D keys or âŦ
ī¸âĄī¸ Arrow Keys.
- Rotations happen at the speed defined by rotationSpeed đī¸.
Mouse Vertical Rotation (X-axis): đąī¸âŦī¸âŦī¸
- Moving the mouse vertically rotates the camera đĨ around its X-axis, allowing the player to look up đ and down đ.
- The script uses rotationX âī¸ to track and clamp the vertical rotation between -90° and 90° âđ to prevent unnatural flipping.
Camera Control: đĨđ
- The playerCamera (child of the player) is rotated independently for vertical movement, while the player object only rotates horizontally âī¸.
Code Highlights đ
moveSpeed đ and rotationSpeed đ:
- Control how fast the player moves and rotates.
- Control how fast the player moves and rotates.
mouseSensitivity đąī¸đī¸:
- Adjusts how sensitive the mouse movements are for smoother gameplay.
- Adjusts how sensitive the mouse movements are for smoother gameplay.
Smooth Movement and Rotation: âŗđŽ
- Multiplying movement and rotation speeds by Time.deltaTime ensures that the motion is consistent across devices, no matter the frame rate.
- Multiplying movement and rotation speeds by Time.deltaTime ensures that the motion is consistent across devices, no matter the frame rate.
Clamping Vertical Rotation: đĢâī¸
- Limits how far the camera can tilt up đ or down đ using Mathf.Clamp, ensuring a natural range of motion.
How to Use: đ ī¸đŽ
- Attach this script to the player GameObject đšī¸.
- Assign the camera GameObject đĨ (child of the player) to the playerCamera field in the Unity Inspector.
Play the scene and control the player with:
- W/A/S/D or Arrow Keys for movement âŦī¸âŦī¸âŦ
ī¸âĄī¸.
- Mouse for looking around đąī¸đ.
- Optional: Use A/D or Left/Right Arrow for explicit horizontal rotation đ.
Enhancements (Optional): đđĄ
- Add jumping functionality đ using Input.GetKeyDown(KeyCode.Space).
- Add smoothing đī¸ to the camera rotation for a more polished experience â¨.
- Integrate physics-based movement âī¸ for a more realistic character controller.
Come take a look!
You can find this project and many more in my Github repositories!