Kinematic vs Dynamic issue

Hello.



So, I’m making a marble game, sort of like Marble Blast Ultra or similar.



I have an elevator moving horizontally between platforms. The odd thing is that when I roll the marble onto the (Kinematic) elevator, it doesn’t “sit” on the elevator, ie. it doesn’t move with the elevator. I have to roll in the direction the elevator is moving, otherwise I’ll fall off. I move the elevator with .move() on the spatial, as the docs suggest, but this doesnt seem to excert any force on the (dynamic) marble (other than the upwards force).



How am I supposed to do it?



PS: Both the ball and the elevator are individual objects with their own collision shapes and rigidbodies. Ball and elevator both have mass=1f while elevator has .setKinematic(true). The ball is moved with .applyCentralForce().



Thanks!

// Xee

Generally, for continuous movement with some object I suggest locking it to that object, you can also make a separate local physics space for the elevator. How exactly do you “fall off”? Like through the floor? What kind of collision shape is the elevator floor? I take it the marble is a sphere.

I thought about parenting the ball/sphere/marble to the elevator (through collision listener), but it feels strange that it would be necessary… Shouldn’t the physics engine accomplish this on its own? If a box is placed on a moving platform, should not the box move with it just due to physics?



Basically, if I roll the ball onto the elevator, then stay still, it will fall to oblivion as soon as the collision shape of the elevator is moved away from underneath it. Did that make sense? I have to roll in the direction of the elevator just to stay on it. The elevator doesn’t bring the ball with it, and it’s not due to lack of friction or anything like that. The elevators horizontal movement (from .move()) just doesn’t excert any (horizontal) forces on the ball.

Horizontal movement, ah, thats not exactly elevation ^^ Well with a ball you’ll have a hard time getting that to work in reality as well :wink: You could try and set the angularFactor of the ball to a low value for that time to avoid its rolling. That basically lets you set a dampening value on the rotation that happens to the ball. It should avoid the force turning into rotational force.

That’s the thing, it’s not actually starting to roll backwards (due to friction). Imagine if it was a box instead, the box would stand still while the “elevator” (or moving platform, if you prefer) moves away from it. Like there’s 0 friction between the object and the elevator. Like something out of a roadrunner cartoon :smiley:

I wonder if this is because the platform is kinematic. (No idea if this will work) What if you create the platform as a RigidBody (not-kinematic, and with a mass) and set its gravity to Zero, and move both the platform and the ball with the same force (taking into account different masses if you choose them to be different). Failing that, try and just move the platform with a force, and if that fails, try move the platform with a force and high friction setting on it as well.

There are probably several ways to solve the problem (such as parenting), but they all seem a bit unneccessary to me. I just think it’s strange that the horizontal movement of the kinematic elevator doesn’t affect the ball in any way, thus leading me to think I’m doing something wrong. Isn’t the point of kinematic objects just this? A remote controlled object that excerts force on dynamic objects, but not vice versa?

You’ll have to ask the bullet creators if you don’t want to try what we suggest.

Hi there!



I’m experiencing the same issue. I am simulating a vehicle that is supposed to hold cargo on a movable platform (a kinematic)



The box, that I have put on the platform for transport, keeps gliding off when i move the vehicle, as if it was completely frictionless (Even though I have explicitly set the friction on both the box and the platform to 0.9).



Let me know if you find something out!



/Henrik

The closest thing I’ve found thus far was this post. Not much in the way of an answer, but if nothing else it at least confirms the issue. Seems a bit odd that vsync would affect the results. To me it sounds like a bug with kinematic objects, and using any of the suggested solutions is probably the best way to go for the time being.



Good luck, and feel free to report your findings as well :slight_smile:

Maybe these threads are helpful to you:

http://hub.jmonkeyengine.org/groups/physics/forum/topic/ball-sinking-into-floor-in-low-fps-situations/

http://hub.jmonkeyengine.org/groups/beta-1-game-contest/forum/topic/wip-tilting-ball-maze-game-in-3d-contest-entry/

@ljugtomten said:
Hi there!

I'm experiencing the same issue. I am simulating a vehicle that is supposed to hold cargo on a movable platform (a kinematic)

The box, that I have put on the platform for transport, keeps gliding off when i move the vehicle, as if it was completely frictionless (Even though I have explicitly set the friction on both the box and the platform to 0.9).

Let me know if you find something out!

/Henrik


Friction won't affect kinematic objects

Hi again!



My current workaround for this is to attach a dynamic mirror platform on top of the other with 2 joints. (Something along the line of what @normen suggested)



It seems to work fairly well for my current purposes, hopefully I won’t run in to stability issues later…



/henrik

Interestning solution :slight_smile:



My solution was a bit “hackier” and not as generic; Every physics tick I add the difference in position of the elevator to the position of the ball while the ball is touching the elevator. Works well for this purpose and feels natural, but would certainly become tedious if I had many objects that wanted to hitch a ride on the elevator :wink: