# Slick Forums

Discuss the Slick 2D Library
 It is currently Sat Jan 19, 2019 6:12 pm

 All times are UTC

 Page 1 of 1 [ 8 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: New BUG ,how to make it ok?Posted: Mon Apr 21, 2008 4:46 am

Joined: Mon Apr 21, 2008 4:37 am
Posts: 1
Hi:
i use Phy 2d Test ,i find bug .
demo is
Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
body1.setPosition(250.0f, 400);
body1.setRestitution(1f);

Body faller = new Body("Faller", new Circle(25), 200.0f);
faller.setRestitution(1.0f);
faller.setPosition(280.0f, 100.0f);
I find then ball's velocity change
ball's Velocity'y:0.0
ball's Velocity'y:0.8333334
....................
ball's Velocity'y:71.66674
ball's Velocity'y:72.50006
ball's Velocity'y:-72.666725
....................
ball's Velocity'y:-0.16666426
we know ,when ball move down then max velocity is 72.50006, when collide the max velocity should be -72.50006. but in fact
,then ball's velocity is -72.666725.
so we can see then ball then collide with box,the max velocity should bigger.
i want make is ok. in then word.java's public void step(float dt)
if (arbiters.size()==0 )
this 's is ball's Velocity'y:
ball's Velocity'y:0.0
ball's Velocity'y:0.8333334
..................
ball's Velocity'y:70.83342
ball's Velocity'y:71.66674
ball's Velocity'y:72.50006
ball's Velocity'y:-72.50006
ball's Velocity'y:-71.66674
...............
----------------------------------------------------------
in this demo that will be right ,but in other demo ,that will be wrong.
how to Judge is run b.adjustVelocity(temp) or not ?
can you send code for me or put on then http://www.cokeandcode.com/phys2d/

my e-mail :XWGMakeGame27@163.com

Top

 Post subject: Posted: Mon Apr 21, 2008 8:56 am

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
I'm having a little trouble understanding what the problem was and what you fixed.

The restitution may be different due to the depth of penetration on the step, i.e. the extra velocity applied to get the ball out of the penetration state.

The only line I can find matching your description (b.adjustVelocity(temp)) in step() is the line that actually applies the current force. Is that the one you've removed?

Kev

Top

 Post subject: Waiting for your reply.Posted: Wed Apr 23, 2008 4:37 am

Joined: Mon Apr 21, 2008 4:40 am
Posts: 5
sorry,my english is poor .
Think you kevglass!!

I think the ball collide with box ,
max_velocity= -1*max_velocity
when ball's Restitution=1 and box 's Restitution=1.
but phy2d is not .
i don't fix the bug ,I try ,but i don't know how to fix .

when arbiters.size()>0 ,then ball collide with box.
phy2d is
ball's Velocity'y:72.50006
ball's Velocity'y:-72.666725
I think should be
ball's Velocity'y:72.50006
ball's Velocity'y:-72.50006

Top

 Post subject: Posted: Wed Apr 23, 2008 7:20 am

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
The fractional difference could be explained by the way the engine works. The ball/box collision isn't exact since movement is done in descrete steps. When a collision is detected the ball is given a little bit of extra velocity to move it out of the incorrect collision state. This velocity should disappear after the ball has moved out of the box penetrated step.

I will however double check to make sure this is whats happening.

Kev

Top

 Post subject: Posted: Wed Apr 23, 2008 10:19 am

Joined: Mon Apr 21, 2008 4:40 am
Posts: 5
Thank you ! Thank you very much.

I Send then my test code <phy2d2008test.rar > in then phys2d at cokeandcode.com

Top

 Post subject: Posted: Thu Apr 24, 2008 3:50 am

Joined: Mon Apr 21, 2008 4:40 am
Posts: 5
Restitution is Elasticity Coefficient ?

I see one guys say about " www.bulletphysics.com"

{There is a bit of restitution due to penetration depth correction: the positional correction adds some velocity. If you make the timestep smaller, this effect should be smaller.

In the future I plan on separating the penetration correction from the velocity correction, which should completely get rid of this unwanted restitution. Note that several other system suffer from the same problem (most notably open dynamics engine/ODE). This has been discussed in other sections of the forum, in case you are interested in the technical background.}

that guy say the bug is same as phy2d??

Top

 Post subject: Posted: Thu Apr 24, 2008 7:19 am

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Actually, I already split the bias velocity from the core velocity, I believe it's just being reported as a whole (or something).

Kev

Top

 Post subject: Posted: Mon Apr 28, 2008 1:22 am

Joined: Mon Apr 21, 2008 4:40 am
Posts: 5
I'm having a little trouble understanding what you say"I already split the bias velocity from the core velocity".

Restitution is Elasticity Coefficient ? is a bug or not ?how to make.

and I want ask you .

if i set SpringJoint like a String. how can get the SpringJoint's Pull dint,when String Hang box or ball.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 8 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ General    Games / Demos    Help / Discussion    Community Projects    Game Ideas/Design    Slick Competition 2011    Android Slick - LWJGL 2D Game Library    Announcements    Bug Reports / RFE    Extensions    Contribution depot Related Libraries and Tools    Phys2D    Tiled    TWL    Fizzy    Artemis Archive    Resolved Bugs/RFE    Useful Posts