That's a HeavyGear. I've been working on a prototype for a game based on these machines. Essentially heavy armored suits around 12-18 feet. With 2 forms of movement. Walking and Wheeled.
The prototype is a bit more arcade like than simulation. So i'm simplifying the collision detection to 2 boxes rather than parts. One to represent the legs and the other to represent the torso. The Gear isn't supposed to be knocked over and the Torso has a Y rotation of -45% to +45%(for now). And the mimic wheeled based movement.
What I'm puzzled over is how i'm going to figure out some of the parts.
1. A Gear move like motored roller blades than a standard vehicle. I thought about using two lower boxes to represent legs and controlling the speed by applying differing central forces to either leg/box for turning purposes. Or just using a single box and do a simple applyCentralForce() for both walking and wheeled.
2. I am using a generic6dofcontrstraint to hold 2 box version together. What I'm not getting is the applying the constraint effectively. I've looked through some posts on g6dof to get an idea how to apply it effectivly for my uses, but i'm not getting it. My knowledge of Bullet physics is still young. So I just don't get the FrameInA and FrameInB work.
I figure I can nail all the all rotation issues with a good configuration. To summarize.
Upper Torso is limited to 90% front face of the Legs. The Legs do not rotate along the Z or X Axis so the object can't "fall" over.
Code: Select all
Object3D torsoGfx = Primitives.getCube(2); // 2 meters
Object3D legsGfx = Primitives.getCube(2);
BoxShape shape = new BoxShape(new Vector3f(2,2,2));
Transform trTorso = new Transform();
trTorso.setIdentity();
trTorso.origin.set(new Vector3f(0,1,0));
Transform trLegs = new Transform();
trLegs.setIdentity();
trLegs.origin.set(new Vector3f(0,3,0));
JPCTMotionState msTorso = new JPCTMotionState(torsoGfx, trTorso);
JPCTMotionState msLegs = new JPCTMotionState(torsoGfx, trLegs);
float mass = 1;
Vector3f inertia = new Vector3f(0,0,0);
RigidBodyConstructionInfo rbInfo = new ...(mass, msTorso, shape, inertia);
RigidBody bodyTorso = new RigidBody(rbInfo);
rbInfo = new ...(mass, msLegs, shape, inertia);
RigidBody bodyLegs = new RigidBody(rbInfo);
Transform frameInA = newTransform();
frameInA.setIndentity();
frameInA. ???
Transform frameInB = newTransform();
frameInB.setIndentity();
frameInB. ???
...Constraint bodyConstraint = new ...6DofConstraint(bodyLegs, bodyTorso, frameInA, frameInB, true);
bodyConstraint.setLimit(4, -math.pi, math.pi); // allows full Y Rotation
Sorry, for probably such a simple matter. The last time I worked with Bullet physics I was doing space ships in space. Wich didn't require so much in joints.
3. Bonus JPCT inverts Y and Z axis compared too Bullet/jBullet. It's like thinking in a mirror. Anyone know how to invert Bullets axis would be so awesome. I tried to see if I could invert JPCT with little luck.