Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Imparting forces and tunneling

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Dec 2017 00:51
Ok so i have a pinball scenario. How do i handle the mechanics?

Right now my flippers and my plunger (To start the ball) are kinematic bodies

I rotate the flipper and move the plunger but they keep tunneling through the ball

Is this the right approach or is there another way or, as usual, am i doing something wrong?
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 15th Dec 2017 02:18
A simple code example would help me see the problem.
But you may have to change the Max Linear Velocity of the ball with SetObject3DPhysicsMaxLinearVelocity() command.
Constatnt collision detection is always on but rigid bodies can still tunnel in some circumstances.
The coffee is lovely dark and deep,and I have code to write before I sleep.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Dec 2017 03:59 Edited at: 15th Dec 2017 04:17
See attached
Note : The board is flat and i have changed gravity to pull along the z axis in an attempt to avoid tilting the board

Attachments

Login to view attachments
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 15th Dec 2017 17:15 Edited at: 15th Dec 2017 17:16
The problem that I can see is that you need to take into account the scale factor for the physics world.
Your table is very small size for the default scale factor(40) of the physics world. Tunneling and other
strange behaviors will occur with and incorrect scale factor. I changed the scale factor to Create3DPhysicsWorld(15)
and it has better results. You will have to experiment to find the best scale factor.
I tweaked the gravity to Set3DPhysicsGravity(0, -2.0, 0.1) but you will have to experiment with these values as well.
I remarked adding restitution to the plunger it seemed to do fine with out it.
Also some times kinematic bodies can impart to much force to a dynamic object so be careful how much movement
you give to them.
I just posted the main file below since its the only changes I made.


The coffee is lovely dark and deep,and I have code to write before I sleep.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Dec 2017 20:58
Thanks Stabbo! My day is made! I will check it out

Login to post a reply

Server time is: 2024-04-19 22:21:38
Your offset time is: 2024-04-19 22:21:38