About Monkey 2 › Forums › Monkey 2 Projects › ToyBox – physics demo kit
This topic contains 13 replies, has 3 voices, and was last updated by
DruggedBunny
1 year ago.
-
AuthorPosts
-
March 27, 2018 at 2:50 am #14144
This is just a really basic bunch of physics stuff I’ve been working on, making it easier to:
-
spawn boxes, balls, cones, etc;
build a simple wall;
shoot bullets… with a hacky little demo: fly around, shoot, drop random objects, rebuild!
Not a serious project, just tweaking and adding things as I go along!
Feel free to use any of it, public domain code. See toybox/toybox.monkey2 for available classes/functions, and testscene.monkey2 demo for usage.
Make sure debug mode is off, and turn off shadows (S) if they slow you down too much.
March 27, 2018 at 4:49 pm #14151Fun!
March 28, 2018 at 12:12 am #14152Thanks!
For any Monkeys with a VR headset (that’ll make at least two of us!), this is the same demo modified for OpenVR.
We can’t render text in a VR view for now, and it’s keyboard-driven (not the best combination!), so you just need to remember/look up the keys!
Cursors, A/Z + Shift: Move
Space: Shoot bullet where you’re lookingEnter: Reset seated position
D: Drop boxes
S: Toggle shadowsF5: Reset scene
That’s the controls I remember anyway…
[EDIT: Now in main zip, see next post.]
Most people will probably find the movement spewy, so just find a position and experiment from there!
March 28, 2018 at 1:01 am #14153Just added two very simple demos, simpletest and simplertest — first drops a box and allows F5 to drop again (with random sizes/bounce), second just drops a box. Includes the VR demo.
April 1, 2018 at 8:03 pm #14189Little update — added a brick wall, which is a more realistic upgrade to the earlier wall, in that the bricks are interleaved, resulting in much more realistic collapsing behaviour. (More realistic still would be to have easily-breakable joints between them… )
Here’s the latest version:
Here’s a simple brick wall to shoot in-browser:
Here’s a brick ‘shot’ house, also in-browser. Note that hitting F5 will rebuild it 3 times the height — this is a lot slower, but looks really cool when it falls, especially if you turn shadows on (which slows it down even more)…
(
I suspect the slow speed in the latter is in part due to using a unique material for each individual brick, just for cosmetic purposes*, and mojo3d being not overly-optimised at this time.)* Update: Not true! Quick test using same material for all makes no difference at all to FPS, at least here on Desktop target.
If you have VR, try the demo in the archive! It’s something else to stand inside a huge tower and see it starting to shift, twist and… collapse upon you!
* NOTE: I use the Github ‘develop’ version. Think it should work with the latest Patreon version too.
April 2, 2018 at 9:44 am #14190on safari:
– shadows don’t work – it just sort of darkens the surface of the objects?
– there’s some sort of really nasty spherical mirror going on the surface. it’s refecting some kind of ladscapeSee enclosed pics
1st one shows reflection (see it on the wall and the floor (sort of cube with dark bottom)
2nd one is with shadows onApril 2, 2018 at 10:21 am #14195Yeah, that’s just default mojo3d stuff. I don’t like the landscape reflection either, assume it’s a texture buried somewhere in the output. Standard shadows, too. Might be worth raising as an ‘issue’ for Mark to look at, with graphic card details, etc.
April 2, 2018 at 10:29 am #14196so mojo3d doesn’t have shadows that work?
April 2, 2018 at 12:36 pm #14198They’re working fine here (I didn’t clarify that), so possibly a driver discrepancy with your setup at a guess? (Just to check, have you tried toggling the shadows on/off? Any visual difference?) Would need to be reported for Mark to investigate if they’re not actually working there.
April 2, 2018 at 12:48 pm #14199yep – toggling the shadows on/off just made the darkened version.
It’s safari, so there are no driver issuesApril 2, 2018 at 1:08 pm #14200Might be worth trying to build for desktop and see if that works for comparison. Failing that, it would need to be reported for Mark to look into. Shadows are definitely working here at least!
April 2, 2018 at 1:20 pm #14201Just a passing note (unrelated to Adam’s case) — I’ve realised why it seems so slow, even though it mostly runs at 60 fps for me: scale!
The bricks in the latest wall examples are like 5m wide, and weigh a kilogram each, so when you’re looking at them and thinking they’re brick-sized, it looks slow (because you’re perceiving your own view to be at that larger scale, I think)…
Scaling down to realistic measurements shows much more realistic (ie. faster) speeds, though the tower collapses right away — likely needs more friction at that scale.
Not that you’d be building an entire tower from life-sized bricks in a real game… !
April 2, 2018 at 10:28 pm #14209Added physics object states/state colouring:
BrickSh!tHouse with state colouring [Web demo]
This is pretty cool, in that you can watch the bricks go to sleep, then shoot and see the affected bricks come to life and sleep again. (Red: normal brick colour; Yellow: physics engine thinks brick should maybe sleep, since not much is happening; Orange: sleeping.)
The FPS is directly affected by the sleep state, in that as objects finally sleep (ie. aren’t being affected by physics), the FPS creeps up to 60 (for me!).
April 10, 2018 at 1:22 am #14305 -
AuthorPosts
You must be logged in to reply to this topic.

