C
C#2y ago
Zagan

❔ Code stops after a bit

I'm trying to make 3d game in unity and i made dice check zone when i roll the dice it shows what i get, but after a bit it will stop showing what i roll
19 Replies
Buddy
Buddy2y ago
$details
MODiX
MODiX2y ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Buddy
Buddy2y ago
Please be more specific in what you need help with - Take a reference of what is mentioned above
Zagan
Zagan2y ago
give me a min or 2
Zagan
Zagan2y ago
and when i roll it agian ir just shows 0
Zagan
Zagan2y ago
heres the codes
hiyosilver
hiyosilver2y ago
Did you check if it ever gets to your switch statement? Comparing floats directly like this is unlikely to work. I'm assuming you mean to test if the die has come to rest completely, i.e. velocity is 0 in all directions. I'm not sure that is ever going to be the case after the initial state due to floating point imprecision.
hiyosilver
hiyosilver2y ago
Also the gif you posted seems to show that the very first roll is already returning the wrong number.
Zagan
Zagan2y ago
in the gif it scanned that i landed on 5 but the dice was still rolling
hiyosilver
hiyosilver2y ago
I also don't quite get why you do a <= check. If my assumption that you are checking if the die has stopped moving is correct.
Zagan
Zagan2y ago
correct i changed it to ==
hiyosilver
hiyosilver2y ago
Still though, did you read my previous posts? That will probably not work You can't directly compare floats with == and expect meaningful, consistent results.
Zagan
Zagan2y ago
so i do it with Mathf.Approximately?
hiyosilver
hiyosilver2y ago
That's the first thing I would suggest.
Zagan
Zagan2y ago
it worked, thanks alot!
hiyosilver
hiyosilver2y ago
Oh, nice.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ IComponentConnector.Connect is explictly implemented more than once errorHi I have this error and idk how to solve it! ive attached the code for that method btw im having li✅ How to edit and save specific appsettings.json (project root) section?Hello, I have issue with editing specific section in the appsettings.json in project root folder, buThe score is not updating when objects are destroyed by a powerupthanks in advance!✅ WPF - Detect if screen resolution is resized (ex. 125% or more)I'm writing a tool in which I need to first set the screen resolution, I currently have a 1920 x 108❔ Passing Variable from pageHello, i'm working with WPF and i use MVVM pattern. How can i share a variable from a page to differ❔ I have a ghost rectangle I can't get rid of in my Towers of Hanoi Windows FormsSo I used ChatGPT for a lot of the ground work and edited like I needed, and added a snap feature so❔ Regex to find string between _ or next uppercase letterCan you help me with regex? ``` Roads_RoadNode Roads_Road_261Node Roads_Curb_91Node Roads_CurbNode R❔ no auth error in a temp cleaner i dont know how to fixi even implemented a catch expression but its still not working✅ How do i make this create button work?(Razor Pages,entityframework)Ok, so i am making an inventory managment site, i connected an sql database to it and i can add stuf✅ WPF Store Singleton Action PropertyChanged optimizationHi! I have a singleton in my app responsible for weather management currently each of my properties