Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 26, 2018 9:37 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Apr 21, 2008 4:46 am 
Offline

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);
world.add(body1);

Body faller = new Body("Faller", new Circle(25), 200.0f);
faller.setRestitution(1.0f);
faller.setPosition(280.0f, 100.0f);
world.add(faller);
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)
i delete then b.adjustVelocity(temp)
and add then code
if (arbiters.size()==0 )
b.adjustVelocity(temp);
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/

Waiting for your reply.

my e-mail :XWGMakeGame27@163.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 21, 2008 8:56 am 
Offline
Site Admin
User avatar

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
 Profile  
 
 Post subject: Waiting for your reply.
PostPosted: Wed Apr 23, 2008 4:37 am 
Offline

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
Waiting for your reply.[/url]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 23, 2008 7:20 am 
Offline
Site Admin
User avatar

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
 Profile  
 
 Post subject:
PostPosted: Wed Apr 23, 2008 10:19 am 
Offline

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


Waiting for your reply.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 3:50 am 
Offline

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
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 7:19 am 
Offline
Site Admin
User avatar

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
 Profile  
 
 Post subject:
PostPosted: Mon Apr 28, 2008 1:22 am 
Offline

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.

Waiting for your reply.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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 forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group