Hi all : So I am trying to keep a running total of how many pins fall as a result of the physics action of the ball striking the list. Depending on which pin’s Z position has changed (all of them should be 0.0 when upright) I am adding 1 to a variable and displaying it. For some reason the value remains 0 even if all the pins fall down. Can someone please take a look and highlight the problem in the code?
You can move the ball left/right using the arrow keys on the keyboard.
Co Space link: CoSpaces Edu :: Bowling Score
Hi @Shashi_Krishna I noticed that you are new in the form. Did you notice the suggestions of @techleapnz in other posts I want to solve the variable problem
Thank you @astrid_hulsebosch. I had not seen that but now that I have, I am not sure it relates to what I am trying to achieve, The example you shared works on collision parameters but what I want is to get the XYZ coordinates for an object as a result of a user based action (in this case throwing the ball) during the play of a cospace. So if any of the bowling pin positions have altered, specifically the Z coordinate value since that being 0 means the object is standing up straight. If it is not 0 then it means it either fell over or tilted or something. What I want is to capture that Z value after the ball was delivered so that I can keep track of how many pins fell over as a result of the ball hitting them. Let me take a closer look at your example though. Maybe there is something I can use…
Hi @Shashi_Krishna here a test scene to know all parameters in position and orientation of an Item. Then I think you can switch from false to true if the Z orientation is not 0, so you can change the score consequently if the Item stands up or not (you can store all these true-false states in another list for example). But, after all, why don’t you use the push block to move the ball and maybe the collision event to set the score value?
Look at this CoSpace if can help you.
Woow @Giuseppe_Schiuma how did you knew this! And how did you created the text? I’m curious
Thank you @astrid_hulsebosch! The texts are generated dinamically by some variables that store the position and the orientation of an item (X, Y and Z axes) and then concatenated into strings. Maybe should be great to have a control panel that shows all these parameters for debugging.
Here it is the main code:
Comparing direction (ie, orientation) might be a better comparison than position, as the origin of most objects is placed at the bottom of the item.
If you set up a debug panel as per @Giuseppe_Schiuma’s suggestion and code, this will definitely help you to understand what’s happening.
Best of luck!
you can think of something easier,
add Vicious circle (ring), in the bottle,
then make it unseen, and if the bottle touch the circle ,add score.
Thank you @Giuseppe_Schiuma, @techleapnz and @Zaitoun2021 for the much appreciated guidance! I feel like I am nearer to the kind of solution I am looking for after embedding some of the elements you suggested. However, the position block which should be technically producing a 0 for all standing objects is not really behaving as expected. As recommended I am using a text/debug panel to generate Z values for each pin in the list after the ball is released. But if 2 out of 3 pins are still standing after impact it seems to be generating non 0 values for them too? Even if I did not touch a pin on purpose even then it creates a non 0 value for it.
I am also tinkering with the physics properties to see if there is some mismatch in how I am imagining the pins to react to gravity and weight. Please feel free to visit my updated link above and see if you spot something I missed? Thanks again for your patience with this.
Euler angles are used to specify the direction (and they are complex), and both direction & position are incredibly sensitive in CoSpaces; so the answer is to round things to where you can get the answer you need.
PS: I started adding direction into a solution, then realised I didn’t need to.
Hope this helps! Let me know if you have any further questions about this. If this solves your issue, please mark this post as the Solution.
This looks like it is what I wanted! Thank you @techleapnz for your help on this!