Sign in to follow this  

Flatland and object forces

This topic is 4139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been having the time of my life trying to figure out how flatland works, and so far I got a basic model with a bunch of bouncing blocks setup. The type of game I want to design is your typical sidescroller. Little to no rotation involved, collision detection, and character movement. Now because Flatland isn't really documented very well, I'm not sure how to approach setting up my structures to modify the output of the engine. I could probably handle moving by shifting the center point of the object, but that still leaves me with jumping and applying a force on the object. From what I've read of the doxygen generated page there isn't an easy way to do any of this. Am I missing something?

Share this post


Link to post
Share on other sites
Alright, I got everything solved up to a point. What I'm trying to do is have all of the players in this 2D sidescroller work as if they're frictionless. I'm able to manipulate the object through ODE calls, so I can apply velocity and force to an object. However I can't manipulate the friction of an object at all. Flatland handles this through the ContactList::Finalize()


void ContactList::Finalize()
00270 {
00271 ObjectProperties& p1 = o1->Property();
00272 ObjectProperties& p2 = o2->Property();
00273
00274 for (int i = 0; i < count; ++i)
00275 {
00276 dContact& c = contacts[i];
00277 c.surface.mode = dContactBounce;
00278
00279 // Not sure how to resolve the frictions and bounciness from the two objects.
00280 // For now I'll multiply the frictions and average the bouncinesses.
00281
00282 if (p1.frictionMask & p2.frictionMask)
00283 {
00284 if (p1.friction == dInfinity || p2.friction == dInfinity)
00285 c.surface.mu = dInfinity;
00286 else
00287 c.surface.mu = p1.friction * p2.friction;
00288 }
00289 else
00290 c.surface.mu = 0;
00291
00292 c.surface.bounce = (p1.bounceFactor + p2.bounceFactor) / 2;
00293 c.surface.bounce_vel = (p1.bounceVelocity + p2.bounceVelocity) / 2;
00294
00295 dContactGeom& cg = contacts[i].geom;
00296 cg.g1 = o1;
00297 cg.g2 = o2;
00298 }
00299
00300 if (p1.callback)
00301 p1.callback(*this);
00302
00303 if (p2.callback)
00304 {
00305 std::swap(o1, o2);
00306 p2.callback(*this);
00307 std::swap(o1, o2);
00308 }
00309 }



It at least provides some calculation of friction, however when I change the property to have no friction it does nothing.

I re-rotate to 0 deg the block so I don't have the block acting like a wheel. This way I can have a character always standing up. Instead of moving the position of the object for the character I use velocity to push the object. This way I let the physics engine deal with collision instead of passing through a testable wall. However when velocity is applied horizontally the object hops. Changing the friction on all the objects doesn't help the hopping any.

I assume that the hopping comes from the re-rotation of the object, when the object is tested it gets rotated due to the friction on the surface. When the object is rotated back to 0 it has a little lift. But I'm setting the friction to 0, it should technically glide over the surface.

Anyone know flatland or ODE well enough to help me with this?

Share this post


Link to post
Share on other sites

This topic is 4139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this