A sphere shape does not reflect when hitting on a box shape

Software: Away3D 4.x

erroneous seth, Newbie
Posted: 01 November 2011 05:16 AM   Total Posts: 28

Hello to everyone,

I have three rigid bodies:

1. a sphere
2. a wall
3. a ground

The problem goes like this:

- A force is applied to the sphere.
- The sphere hits the wall.
- The sphere keeps on going “following” the wall, instead of bouncing back.

The exact code I use that leads to the above scenario is scattered around few classes. However, I believe the following three points are the ones that matter:

1. The sphere is represented by an “AWPSphereShape”:-)
2. The wall & ground are both represented by an “AWPBoxShape”.
3. The force is applied by calling the “AWPRigidBody.applyCentralForce” method.

There is a “.swf” file attached that depicts the above scenario.

Could anyone, please, tell me why the ball does not reflect back but keeps on colliding with the wall?


Thank you very much.

P.S. Of course, if anyone believes that the source is needed I will attach it, as well.

 

File Attachments
non-reflecting_ball.rar  (File Size: 19KB - Downloads: 0)
   

John Brookes, Moderator
Posted: 01 November 2011 03:13 PM   Total Posts: 732   [ # 1 ]

Set the restitution on the rigidBodies.

   

erroneous seth, Newbie
Posted: 01 November 2011 08:07 PM   Total Posts: 28   [ # 2 ]

I have set “restitution” for both bodies. However, the sphere still does not reflect when hitting on the wall.

Is it, perhaps, something about the forces applied?

   

erroneous seth, Newbie
Posted: 02 November 2011 03:37 PM   Total Posts: 28   [ # 3 ]

I’ve performed some tests (all night long:-)) and, I have come to a conclusion that I would like to share for discussion.

The test files are here.

In the “.rar” linked there are 3 differently suffixed files:

1. ...Force300
2. ...Force500
3. ...Force700

To run them, open the “.html” files and click. You should see the ball going up against the box.

The files above contain different implementations regarding the magnitude of the force applied to a sphere. This sphere hits a box in an angle (with the z-axis) of -45 degrees.

What is interesting is that in “Force300” the ball seems to not bounce back at all. It just keeps moving along the box.

However, as the force increases, we observe that the ball seems to bounce back in an increasing angle after the collision with the box. In “Force500” the angle is bigger than the (almost zero) angle in “Force300” and, in “Force700” the angle is even bigger.

That seems a little odd to me because I’d expect the ball to bounce back in the same angle without taking into consideration the magnitude of the force applied to the ball. The magnitude of the force would have effect only on the distance (not the angle) travelled after the collision.

Could someone tell me if the situation depicted in the three files above is the expected one and if yes, explain why?


Thank you very much for your answers.


P.S. I have also included the project files used for the creation of the above three files.

   

John Brookes, Moderator
Posted: 03 November 2011 02:19 PM   Total Posts: 732   [ # 4 ]

Don’t know whats happening, but…

If you set

sphereRB.contactProcessingThreshold = 0.0;

it bounces at low velocity.

Not a clue what contactProcessingThreshold is.
Its default value seems weird 999999984306749400 ?

   

empend, Member
Posted: 23 February 2012 01:31 AM   Total Posts: 77   [ # 5 ]

Has anyone figured out how to fix this?
I’m having the same problem.

   

John Brookes, Moderator
Posted: 23 February 2012 03:29 PM   Total Posts: 732   [ # 6 ]

Restitution isn’t that perfect in Bullet, it does the same in the Dynamica Maya plugin.
If you do a simple ball drop the rebound hights are not always the same or decreasing. The ball tunnels a little bit sometimes and gets extra force.

DId you try setting the cpt to 0

   

empend, Member
Posted: 23 February 2012 04:21 PM   Total Posts: 77   [ # 7 ]

I have tried messing with the contactProcessingThreshold, but it still doesn’t have anywhere near the effect it should have.

The sphere barely even moves.
The boxes basically go through it, and if a box sits in it long enough it will move a little.

I fixed it!
Seems I made the sphere too small, and it apparently doesn’t work if its too small.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X