mojo3d physics… why am I not colliding?

About Monkey 2 Forums Monkey 2 Programming Help mojo3d physics… why am I not colliding?

This topic contains 4 replies, has 2 voices, and was last updated by  DruggedBunny 1 year, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12764

    DruggedBunny
    Participant

    I’m sure I ran into this months ago, but can’t find any trace of it!

    The box and ground here don’t collide, though both have default collision group and mask of 1.

    See Class PhysBox and CreateArena (“gb = New PhysBox” creates ground).

    I’m unsure if I’m missing something, or if it was some kind of timing thing causing the collision to go undetected.

    Would really like to see some kind of wrapper for this stuff, which is obviously what I was attempting here…

    Also, how do the collision groups/masks work? Using mojo3d\tests\shapes.monkey2 I see CollisionMask is always 127, though these values default to 1 in the definition of New RigidBody (entity).

    Something like cubes with collision group 1, spheres with collision group 2, and masks for both being (1 + 2) = 3 would mean cubes and spheres collide, something like that?

    Should both values being 1 for ground and box cause collision here?

    #12765

    Mark Sibly
    Keymaster

    Collision groups/masks are just the way bullet does it and I may yet change it for mojo3d.

    Both mask and group are just (16 bit) bitmasks, and both (entity1->mask & entity2->group) AND (entity2->mask & entity1->group) must be non-0 for entities to collide. I think – I find it really confusing myself too!

    Safest thing to do is just make mask and group the same for all entities (non-0 though), and all entities can then collide. They default to 1 anyway.

    This stuff is very much in flux right now, but I am working on it this week/right now.

    #12771

    DruggedBunny
    Participant

    Thanks, Mark — thy are both 1 at the moment, but aren’t colliding in this demo. Will be playing again tonight though, no doubt.

    #12784

    DruggedBunny
    Participant

    Sorted this — turned out to be the order in which I was declaring the Boxf parameters at start of PhysBox.New ()!

    Was:

    … but should be:

    #12785

    DruggedBunny
    Participant

    This is pretty cool, but I can’t figure out how to delete/remove RigidBodies… see KeyHit (Key.Space). I’m trying to clear my stack of PhysBoxes (containing RigidBody and Model references), but they always remain! Perhaps not implemented yet? There is code that looks intended to work in RigidBody.OnDestroy…

    Rotation doesn’t work, either, as the RigidBody doesn’t pick up the Model’s rotation, which I suppose it to be expected, though it picks up position. Not sure how this should be handled…

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

You must be logged in to reply to this topic.