Carrot Run video
Games and Applicationsnice with the combined 2d/3d. Is the tweak of the car in mid air from user input?
Near the end when it resets, that's a special key for debugging. If you mean the rotate that it does when leaving the platform, that's just real physics.
at 0:15 it makes a sudden counterclockwise rotation - thats what i meant
Oh yes. Accelerating in the air causes the car to spin counterclockwise in order to force the rear wheels to spin clockwise. For playability sake, I suspect that some sort of spring force keeping the car facing in the direction that it is moving linearly will be better.
Very cool! Looks like a great start to a game.
I look forward to b2linejoint making it to the Actionscript 3 port and playing around with it! 🙂
I look forward to b2linejoint making it to the Actionscript 3 port and playing around with it! 🙂
Code:
b2Shape* make_segment(b2Body* body, float x1, float y1,
float x2, float y2, float friction, float restitution, bool isSensor,
short groupIndex, unsigned short categoryBits, unsigned short maskBits)
{
b2Vec2 normal(y1 - y2, x2 - x1);
normal.Normalize();
normal *= 0.05f;
b2PolygonDef polyDef;
polyDef.vertexCount = 4;
polyDef.friction = friction;
polyDef.restitution = restitution;
polyDef.isSensor = isSensor;
polyDef.filter.groupIndex = groupIndex;
polyDef.filter.categoryBits = categoryBits;
polyDef.filter.maskBits = maskBits;
polyDef.vertices[0] = b2Vec2(x1, y1) + normal;
polyDef.vertices[1] = b2Vec2(x1, y1) - normal;
polyDef.vertices[2] = b2Vec2(x2, y2) - normal;
polyDef.vertices[3] = b2Vec2(x2, y2) + normal;
return body->CreateShape(&polyDef);
}
float x2, float y2, float friction, float restitution, bool isSensor,
short groupIndex, unsigned short categoryBits, unsigned short maskBits)
{
b2Vec2 normal(y1 - y2, x2 - x1);
normal.Normalize();
normal *= 0.05f;
b2PolygonDef polyDef;
polyDef.vertexCount = 4;
polyDef.friction = friction;
polyDef.restitution = restitution;
polyDef.isSensor = isSensor;
polyDef.filter.groupIndex = groupIndex;
polyDef.filter.categoryBits = categoryBits;
polyDef.filter.maskBits = maskBits;
polyDef.vertices[0] = b2Vec2(x1, y1) + normal;
polyDef.vertices[1] = b2Vec2(x1, y1) - normal;
polyDef.vertices[2] = b2Vec2(x2, y2) - normal;
polyDef.vertices[3] = b2Vec2(x2, y2) + normal;
return body->CreateShape(&polyDef);
}
Original thread: https://box2d.org/forum/viewtopic.php?t=1357