In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to get Unity dice throw and points, the text is very detailed, with a certain reference value, interested friends must read!
Above first.
I won't say much about the construction of the scene, mainly dice.
method is as follows
First of all, we need to make our own six sides of the dice (this is the only way I can think of, but it will work anyway).
Each face is then renamed to a unique name based on the number of points on the dice.
For convenience, I use 1, 2, 3... to name it.
Finally, add a rigid body to it to make the dice more realistic.
PS: The extra GameObject is to adjust its center point and facilitate rotation.
Next, let's spin the dice!
When the left mouse button is clicked, a random value is given in X, Y and Z directions respectively.
Then add the desired rotation angle to the current position of the dice.
Here we give a timer and let it rotate for two seconds.
if (Input.GetMouseButtonDown(0)) { isdebug = true; //take XYZ random rotation value p_x = Random.Range(minrot, maxrot); p_y = Random.Range(minrot, maxrot); p_z = Random.Range(minrot, maxrot); timer = 0.0f;//timer cleared after click} if(timer
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: 0
*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.