ToyBox – physics demo kit

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 2 months, 1 week ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #14144

    DruggedBunny
    Participant

    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.

    Quick web demo

    Source

    Make sure debug mode is off, and turn off shadows (S) if they slow you down too much.

    #14151

    abakobo
    Participant

    Fun!

    #14152

    DruggedBunny
    Participant

    Thanks!

    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 looking

    Enter: Reset seated position
    D: Drop boxes
    S: Toggle shadows

    F5: 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!

    #14153

    DruggedBunny
    Participant

    Just 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.

    Simple examples plus VR

    #14189

    DruggedBunny
    Participant

    Little 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:

    ToyBox Source

    Here’s a simple brick wall to shoot in-browser:

    Brick Wall

    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)…

    Brick Sh!thouse

    (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.

    #14190

    AdamStrange
    Participant

    on 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 ladscape

    See 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 on

    #14195

    DruggedBunny
    Participant

    Yeah, 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.

    #14196

    AdamStrange
    Participant

    so mojo3d doesn’t have shadows that work?

    #14198

    DruggedBunny
    Participant

    They’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.

    #14199

    AdamStrange
    Participant

    yep – toggling the shadows on/off just made the darkened version.
    It’s safari, so there are no driver issues

    #14200

    DruggedBunny
    Participant

    Might 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!

    #14201

    DruggedBunny
    Participant

    Just 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… !

    #14209

    DruggedBunny
    Participant

    Added 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!).

    ToyBox Source

    #14305

    DruggedBunny
    Participant

    Updated to use new TerrainCollider in ‘develop’ branch:

    [TerrainBody web demo]

    ToyBox Source

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.