In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Unity how to achieve 3D maze Mini Game related knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that after reading this Unity how to achieve 3D labyrinth Mini Game article will have a harvest, let's take a look.
I. Preface
Nothing to do, starting from scratch the whole "3D maze" Mini Game.
II. Conception
First of all, to achieve a Mini Game, you must have a general idea in mind, and then perfect it.
My idea is to build a maze with three-dimensional walls, then control the characters to move through the maze, and finally find the exit, it's as simple as that.
Of course, this is a prototype, for example, you can add some sound effects, background, levels, decryption and so on.
So to sort out the implementation ideas are as follows:
Build a 3D maze
Realize the movement of characters
Implement the entrance and exit logic
OK, the following is the official development.
Third, formal development 3-1, set up the scene
First of all, create a new project. I use the Unity 2019.4.7f1 version. The project name and location can be set according to your preferences:
Next, to build a maze, create a new Plane, make it as large as possible, and expand it tenfold:
Create a new Cube, resize it to make it look like a wall, and then build a maze:
3-2. Set up entrances and exits
Put two Cube, set the zoom, change the exit name to Exit, and then check whether the ball has reached the exit by collision detection.
3-3. Add roles
In the Hierarchy view, right-click to select 3D Objcet → Capsule, create a new sphere, and add the Rigibody component:
Set the Drag grip to 1.
Just set it up in this way, and you can adjust it again if the parameters are not suitable in the actual operation.
Move the ball to the entrance.
3-4. Realize the role movement
The official first-person mobile code RigidbodyFirstPersonController .cs is directly used here:
Public class RigidbodyFirstPersonController: MonoBehaviour {[Serializable] public class MovementSettings {public float ForwardSpeed = 8.0f; / / Speed when walking forward public float BackwardSpeed = 4.0f; / / Speed when walking backwards public float StrafeSpeed = 4.0f; / / Speed when walking sideways public float RunMultiplier = 2.0f; / / Speed when sprinting public KeyCode RunKey = KeyCode.LeftShift Public float JumpForce = 30f; public AnimationCurve SlopeCurveModifier = new AnimationCurve (new Keyframe (- 90.0f, 1.0f), new Keyframe (0.0f, 1.0f), new Keyframe (90.0f, 0.0f)); [HideInInspector] public float CurrentTargetSpeed = 8f Tincif! MOBILE_INPUT private bool m_Running # endif public void UpdateDesiredTargetSpeed (Vector2 input) {if (input = = Vector2.zero) return; if (input.x > 0 | input.x
< 0) { //strafe CurrentTargetSpeed = StrafeSpeed; } if (input.y < 0) { //backwards CurrentTargetSpeed = BackwardSpeed; } if (input.y >Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 294
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.