Creating a Stacking Game for My Students - Physics?

I tried to create a stacking game to demo to my students how Needle Engine works for games, but I failed.
Does someone have a quick demo how to add rigidbody with Gravity to a gameObject, and test if a gameObject collides with a trigger Collider Box to increment a score by one and display the score in a UI Text box, or reveal a “Game Over” text box?

Original Post on Discord

by user 581381221087445033

Hey! So something like this: https://bruno-simon-20k-needle.glitch.me/ should “just work” (regular BoxColliders and Rigidbody in Unity) – which issues did you run into?
.

What you describe sounds like a great starter scene / sample though, can you add it here: needle-tools/needle-engine-support Demo And Starter Ideas · Discussions · GitHub

I assume this has to do with getting callbacks for physics events (like in Unity with TriggerEnter <> TriggerExit) ?

Thanks. Yes, 20K is very close to what I want. But, I couldn’t even load the meedle.engine.samples from GitHub to play with it.

by user 581381221087445033

What stopped you from using the samples?

OK. Got it running in Unity now. Not sure what I was doing wrong.

by user 581381221087445033

I’m currently improving the collider support too - making it more like in Unity with onCollisionEnter Exit and Stay events

Thank you, thank you for adding Unity like collider support. That will be great.

In the 20K demo, what would be the easiest way to add a cube that, is either a trigger or collider that adds a score in a UI Textbox when any hat hits it?

If you can write it and send the cube and UI Textbox & TS script to me as an example in a Unity package that I can import, to study, I’d appreciate that to pass on to my students.

(Seems faster than you taking the time to talk me through it step by step).

by user 581381221087445033

Or, could I copy and paste a gameObject from SpacialTrigger scene?

by user 581381221087445033

@Darius Clarke I’m just adding callbacks that make working with collisions much easier and will try publish a new version and share an example with you later
unknown.png

the scene looks like this right now
20221013-213257_Collaborative_Sandbox_-_Google_Chrome.mp4

ok fun already :smile:
20221013-213922_Collaborative_Sandbox_-_Google_Chrome.mp4

Works in AR too :slightly_smiling_face:

Hey can those make some random pling sounds when colliding? :smile:

haha

quick AR video
screen-20221013-214132-640p.mp4

will publish now so you can play with it in a moment @Darius Clarke :slightly_smiling_face:

https://needle-physics-sample.glitch.me/ first here’s a quick deploy

Awesome! Thank you, thank you! Trying it out right now! :slightly_smiling_face:

by user 581381221087445033