Collision shape: Hull, Mesh and 'fall-through'

  • Still working on elevators, which seem to stress the API a bit... :/


    Two possibilities:


    A) If the model of the elevator is created with a Hull collision shape:


    model.setCollisionShape(CollisionShape.createHullCollisionShape());


    *) A player standing on the model is correctly brought up and down when the model moves up and down (well, a bit shakily, but it works).
    *) But of course he cannot enter inside of the elevator cabin, which has been defined as a solid hull by the collision shape.


    B) If the model of the elevator is created with a Mesh collision shape:


    model.setCollisionShape(CollisionShape.createMeshCollisionShape());


    *) A player can enter the elevator cabin (no longer a solid hull but a hollow mesh).
    *) But, when standing in it, if the elevator moves up, the player remains at its current position and eventually falls to the ground below the elevator (note that when the elevator moves down, the player meets a solid elevator floor when 'catching up' with the descent; so, again a bit shakily, but down movement works).


    Am I overlooking something? There are other ways to achieve this required result (hollow cabins, which are however solid) ?

  • That's unfortunately a limitation of the collision shapes :/ Probably it would be favorable to move the player as well as long as the elevator moves (by using the moveTo() method)

    Well, thinking again, the very moveTo() method does not seem to work even with a WorldElement (i.e. the elevator itself), as described in this thread. I did the test described in the OP using setPostion() instead (which also has problems, but they can be 'worked around').

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!