Box2D Forums

It is currently Wed May 22, 2013 4:18 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
PostPosted: Wed Mar 30, 2011 10:21 am 
Offline

Joined: Tue Sep 25, 2007 2:22 pm
Posts: 482
Sketch, the problem that you are seeing in doug's demo is entirely due to the weight distribution. If the weight was moved towards the front, you would get the understeer that you would be used to in most real cars.


Top
 Profile  
 
PostPosted: Wed Mar 30, 2011 8:11 pm 
Offline

Joined: Thu May 27, 2010 6:52 am
Posts: 137
Thanks for the feedback sketch!

Yea, pTymN's got it...the biggest factor that affects power slides is the car's center of mass, so for the player's car in the demo, moving that circle in the rear closer to the car's center might give you what you're looking for.

Fixing the slice function to handle more than 3-4 partial slices is a BIG entry on the todo list. I just took a new job with a cross-country move to boot, so fixes/features are coming slower than I'd like. That's at the top though cause I think it will attract more people to use the library.

Not sure what you're asking in regards to the distance joint. You want it to be more springy, or soft? You can mess around with frequencyHz and dampingRatio.

Thanks again!

- Doug


Top
 Profile  
 
PostPosted: Thu Mar 31, 2011 6:46 am 
Offline

Joined: Tue Feb 24, 2009 4:10 pm
Posts: 564
Location: Michigan
box2d distance joints seem to be too stretchy.
if you have a character hanging of a rope, and the rope is chains of bodies connected by distance joints. that rope frequently separates and passes by small or sharp objects it should wrap around.
it felt like yours were less separate-able but its probably hard to tell with a chain of only 2 or 3. so never-mind i guess.


Top
 Profile  
 
PostPosted: Thu Mar 31, 2011 6:53 am 
Offline

Joined: Thu May 27, 2010 6:52 am
Posts: 137
QuickB2 uses Box2D for the back-end physics simulation, so the distance joint behavior will be the same. The demo's have a pretty low time step with high iterations, so that probably limits the amount of stretching. But yea, if you had large mass differences, or chains, you would still see stretching at some point.


Top
 Profile  
 
PostPosted: Thu Mar 31, 2011 6:53 pm 
Offline

Joined: Tue Sep 25, 2007 2:22 pm
Posts: 482
I use lots of smaller timesteps to get stiff distance joints.


Top
 Profile  
 
PostPosted: Thu Jun 23, 2011 6:23 am 
Offline

Joined: Thu Jun 23, 2011 6:19 am
Posts: 1
Hi guys,

I'm porting the first example to Corona. It doesn't have some methods which default Box2D library has.
Code:
function killOrthogonalVelocity(targetBody:b2Body){
   var localPoint = new b2Vec2(0,0);
   var velocity:b2Vec2 = targetBody.GetLinearVelocityFromLocalPoint(localPoint);
 
   var sidewaysAxis = targetBody.GetXForm().R.col2.Copy();
   sidewaysAxis.Multiply(b2Math.b2Dot(velocity,sidewaysAxis))
 
   targetBody.SetLinearVelocity(sidewaysAxis);//targetBody.GetWorldPoint(localPoint));
}


My problem is at the killOrthogonalVelocity method. I ported it to this one:
Code:
local dot = function (x0,y0,x1,y1)
   return (x0*x1 + y0*y1)
end

local killOrthogonalVelocity = function(body)
   bodySpeedX,bodySpeedY = body:getLinearVelocity()

   bodySideWayX = math.sin(body.rotation/180*math.pi)
   bodySideWayY = -math.cos(body.rotation/180*math.pi)

   bodySideWayX = bodySideWayX * dot(bodySideWayX,bodySideWayY,bodySpeedX,bodySpeedY)
   bodySideWayY = bodySideWayY * dot(bodySideWayX,bodySideWayY,bodySpeedX,bodySpeedY)
   
   body:setLinearVelocity(bodySideWayX,bodySideWayY)
end


I think It's pretty easy language. So you can understand what I did. Do you see where my mistake is? Instead of getting rotation vector like "targetBody.GetXForm().R.col2.Copy();" I used simple trigonometry for it. I assume it is correct but when I try to turn my car it starts to spin.

Thank you!


Top
 Profile  
 
PostPosted: Mon Jun 27, 2011 8:01 am 
Offline

Joined: Sun Jun 05, 2011 9:55 am
Posts: 5
This is valuable for me.
Thanks....


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4, 5

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


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:
Powered by phpBB® Forum Software © phpBB Group