Padding

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Padding

Postby Stucuk » Fri Aug 27, 2010 12:25 pm

Im working on a Breakout style game and occasionally the ball seems to hit 2 bricks right where they both meet, but instead of bouncing how you would expect it to, it seems to bounce as if there was only one brick there and it hit that bricks edge instead. Im wondering if padding the bricks by a small amount(Small enough so the visuals don't look wrong) is likely to remove the error?
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Julio Jerez » Fri Aug 27, 2010 12:27 pm

it is a collision tree?

This is a Bug in the collision tree mesh.
I got test code for fix it, but I have no have the time.
I have let that go for too long, I thonk is tiem to adress it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Padding

Postby Stucuk » Fri Aug 27, 2010 12:51 pm

There just normal box's( NewtonCreateBox() ). Each Brick in the game is a separate Box Collision. Below is what the collisions looks like, note that since im rendering the Debug Display in 3D and the game in 2D they don't overlay(Never bothered to convert it to 2D).

- SEBS_Collision.png
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Julio Jerez » Fri Aug 27, 2010 1:51 pm

Oh I see, this is very similar to the edge bug in collision tree but here you have adjecent solid object shapes.

at the edge the ball will generate a contact pointing away from the edge, in the secund mesh it will generate a contact pointing in the reflected direction.
if this alway happen it will be fine becausethe the component that oppose each othre will canceled,
however if only one contact is produced or one contact two contacts but one is rejected because of proximity the the ball will bounce in the direction of the contact.

That is a tuff one because there in not clear way fo determine the relation bewenn contacts from one Box and the Ball and the contacts from teh secund Box and the Ball,
they are in two different joints.

if the Box are fixed, maybe try to making the box larger in the place where they meet, that way the will be an overlaping region that will no let edge contacta being generated.
This is just an idea, I do not knwo what it will do.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Padding

Postby Stucuk » Tue Aug 31, 2010 10:00 pm

Doesn't seem to help. Would the following be possible:

In the ContactProcess work out if the Ball is one of the body's and if so do the following:
1. Go through all contacts of the ball and see if one of them is not an edge and one is an edge.
2. If there is 2 contacts where one is an edge and one isn't, delete all edge contacts from the Contact Joint's the Ball belongs to.

No clue how to work out if a contact is on the edge of the collision though. With padding applied technically there should always be one non-edge when 2 bricks are hit by the ball at the same time.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Fri Sep 03, 2010 8:52 pm

Bump.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Julio Jerez » Sat Sep 04, 2010 9:54 am

I have to think about. can you post a video so that I can see the problem better?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Padding

Postby Stucuk » Sat Sep 04, 2010 11:56 am

Not without implementing a reply system and generating a video frame by frame from it. My pc s.u.c.k.s, so recording using a video capturer just has the ball "Jumping" about rather than being smooth. So you can't really see clearly whats happening from the video.

The following image should help. The first image shows what we expect, the ball travels to the edge of 2 bricks(Pink Line) and then bounces off (Green Line) in a symmetrical path. The second image shows whats actually happening. The ball hits the bricks and then bounces straight back along the same path it took to get there, just as if there was only one brick and it hit its edge.

Image
Last edited by Stucuk on Sun Sep 05, 2010 3:56 am, edited 1 time in total.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Sun Sep 05, 2010 3:55 am

@Julio Jerez: I have sent you a test case via PM.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Sat Sep 11, 2010 3:24 pm

I have "Hacked" my way around the problem. Each brick still has its individual Box Collision except that its not collidable (Just used to test if the ball has hit it, all contacts are removed from the joint to prevent collision) but there is now an optimised collision tree thats created from the bricks (Only the faces which are on the outside are added to it), which is updated each time a brick is destroyed. That way there is never more than 1 edge when the ball hits.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Sun Sep 12, 2010 6:08 am

Not as perfect a solution as i thought. Unlike box's collision trees allow small objects to penetrate, but with continuous collision on and a normal size ball, it doesn't react properly. After hitting bricks a few times, if it hits a brick that can't be destroyed it seems to stop and start Wiggling. It only seems to happen when the ball travels diagonally at about 45 degrees, when its angle is lower it seems to work fine. Without continuous collision everything works fine for the normal sized ball.

I can send a test case if it would help.

Note: It only seems to happen with the collision tree. If i remove it and make the bricks Box Collisions collidable then there is no problems with continuous collision.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Sun Sep 12, 2010 10:11 am

Tested with Tiny, Normal and Large ball sizes and they all react the same with continuous collisions on when hitting a collision tree.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Mon Sep 13, 2010 7:46 am

Made the bricks have Null Collisions instead of box's and the Ball still reacts the same, so its got nothing to do with having some box's and a collision tree occupying the same area. Was continuous collision broken?
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Padding

Postby Stucuk » Mon Sep 13, 2010 8:52 am

Made a video of the problem (Tho it doesn't capture how much it really wiggles, you can't see it pause at all in real-time).

- http://www.stucuk.net/ContinusCollisionWiggle.mov

P.S The song in the video is Rush by Serberis (I Legally need to attribute author).
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron