Ok. wheel spins good, ball drops, etc. Time to detect where the ball is resting.
Here was a suggestion from @Monster :
“Determine when the ball comes to rest
On Changing of the slot number you can reset a timer property to zero. You can set a time limit (e.g. 1 second) the ball needs to keep the same slot number (but not -1).
After the time limit this number is the thrown number.”
… That is kind of what im going for.
@Galan, I have read over your suggestions too, ty.
I think I have a good solution, but don’t know how to implement it.
What I have so far: Ball drops into the spinning wheel, and G-force forces it toward the outside of the numbers… so far so good.
There are detection cubes on the outside of the numbers for the ball to rest against. Which works great so far.
In physics… it may rest against the cube for 30 game frames, then slight bump off, then rest again… which is fine.
Also, when bouncing around, it will be bumping into these detection boxes randomly.
What I want to try to do is something like this.
AllOtherDetectionCounters = 0; <i>//All other detection cubes counter will be set to 0</i>. <i>Need to do that because the ball still might be bouncing.</i>
ThisCubeCounter++ <i>//The cube that it is touching will be updated once per game cycle</i>.
If(ThisCubeCounter = 100) Then
This is our winning number
Here is what I have so far for detection. It is attached to a detection cube.
#IF it can loop around soo many times, without
#triggering another number, then this must be the number
cont = bge.logic.getCurrentController()
#own = cont.owner
sens = cont.sensors['Touch']
#actu = cont.actuators['myActuator']
print("positive") #this runs every game cycle
#print("not positive") #doesn mean its not there, just means its not touching at the moment
My questions are… Can I create global arrays somewhere? If so, that would be great.
Do I have to create 38 game properties maybe, and use them as counters?
Do I have to create 38 different scripts and attach them to each detection cube?
The hardest part is figuring out what tools I have available, and how exactly blender runs them. Like… How can I initiate some variables to use throughout all the scripts, etc.
Ok guys, if you can help, thank you. Sorry to bug you. No worries though, not long from now, ill be helping answer the questions. =)
I think I kind of have it… Im creating a script to run once, using the
import GameLogic as GL
so… this might work… somehow.