I'm afraid I don't quite understand what frames are (6dof)

eSalt
Posts: 15
Joined: Tue Jul 19, 2011 4:08 pm

I'm afraid I don't quite understand what frames are (6dof)

Post by eSalt »

I feel ashamed for asking what is probably the most basic question of all, especially considering my constant pestering as of late. The thing is, the physics course I took in high school was very basic, and I have yet to start college. (took a few extra years to complete high school, I work slow)

Anyways, what do the frame parameters of the btGeneric6DofConstraint mean? I can tell from the demo that they seem to establish some sort of point of reference between the two bodies. How do they work? What happens when there is just the one body?

Once again, sorry for bothering everyone. I'm probably a bit over my head with this project, but the way i figure it, I probably won't have time/be able to do this project by the time I finish college.
SteveDeFacto
Posts: 31
Joined: Sat Jul 23, 2011 4:24 pm

Re: I'm afraid I don't quite understand what frames are (6do

Post by SteveDeFacto »

eSalt wrote:I feel ashamed for asking what is probably the most basic question of all, especially considering my constant pestering as of late. The thing is, the physics course I took in high school was very basic, and I have yet to start college. (took a few extra years to complete high school, I work slow)

Anyways, what do the frame parameters of the btGeneric6DofConstraint mean? I can tell from the demo that they seem to establish some sort of point of reference between the two bodies. How do they work? What happens when there is just the one body?

Once again, sorry for bothering everyone. I'm probably a bit over my head with this project, but the way i figure it, I probably won't have time/be able to do this project by the time I finish college.
I had this same problem. The frames are local to each body. When you constraint two objects together with both frames set to identity the second object is moved to the first object. As you extend frameA it offsets ObjectB so that the object will rotate at it's origin but moved by the offset of frameA. Moving frameB is basically moving the origin of ObjectB without moving the origin of the constraint's rotation. It's kinda hard to describe, if you are still having problems you should look at the ragdoll sample and move around the frames on a leg or something until you understand how they work.
eSalt
Posts: 15
Joined: Tue Jul 19, 2011 4:08 pm

Re: I'm afraid I don't quite understand what frames are (6do

Post by eSalt »

I think I'm starting to get a feel for it now. I'll definitely mess around with that ragdoll demo when I'm at my computer in a few hours. (hmm... iPad does not like ragdoll being one word...) At the very least, things are clearer now than before. Thank you for clear cutting the weeds of uncertainty! :lol:
eSalt
Posts: 15
Joined: Tue Jul 19, 2011 4:08 pm

Re: I'm afraid I don't quite understand what frames are (6do

Post by eSalt »

I don't have the time to put everything together in a test tonight, but I'm fairly certain I understand how it works, now that I've cross-referenced what you said, the ragdoll demo, and the (sparse, but eventually helpful) documentation. frameInA sets the point around which bodyB pivots, I believe in respect to bodyA (possibly bodyB). frameInB sets the new location of bodyB in relation to bodyA. frameInB also determines the reference position that the upper and lower limits abide by.

Thus, using just bodyB and frameInB will move bodyB to the offset from the world's origin given by frameInB, with the given Euler orientation of frameInB? Then the axes of linear movement will be pointing in the directions indicated by that orientation?

Am I right about this, or am I still out to lunch? (or supper, as the time here would dictate) :wink:
SteveDeFacto
Posts: 31
Joined: Sat Jul 23, 2011 4:24 pm

Re: I'm afraid I don't quite understand what frames are (6do

Post by SteveDeFacto »

eSalt wrote:I don't have the time to put everything together in a test tonight, but I'm fairly certain I understand how it works, now that I've cross-referenced what you said, the ragdoll demo, and the (sparse, but eventually helpful) documentation. frameInA sets the point around which bodyB pivots, I believe in respect to bodyA (possibly bodyB). frameInB sets the new location of bodyB in relation to bodyA. frameInB also determines the reference position that the upper and lower limits abide by.

Thus, using just bodyB and frameInB will move bodyB to the offset from the world's origin given by frameInB, with the given Euler orientation of frameInB? Then the axes of linear movement will be pointing in the directions indicated by that orientation?

Am I right about this, or am I still out to lunch? (or supper, as the time here would dictate) :wink:
I'm just as confused by your explanation as I am about my own... Maybe this will help:

Code: Select all

btTransform frameInA, frameInB;
frameInA.setFromOpenGLMatrix((float*)&(bodyMatB * Ovgl::MatrixInverse(&Ovgl::Vector4Set( 0.0f, 0.0f, 0.0f, 0.0f), &bodyMatA)));
frameInB.setIdentity();
Basically for my ragdolls I just offset frameA by the difference of the bodies that I'm trying to joint and leave frameB as identity.
eSalt
Posts: 15
Joined: Tue Jul 19, 2011 4:08 pm

Re: I'm afraid I don't quite understand what frames are (6do

Post by eSalt »

Then we both appear lost. Or at least, I am. The ragdoll example is a good one, but it works with already limited joints, which really isn't what I was going for. I'm looking to lock an object's movement along an arbitrary axis, by using a 6 degree of freedom constraint. If it is at all possible to only have the constrained object (bodyB), and not have the bodyA, I would prefer that method.

Let's say i want to have a rigid body only be able to move between points 5, 3, 5 and -4, 3, 10. How would I do that?

I've experimented with the constraint a bit, but it is a fair bit difficult to experiment with because my rendering engine or wrapper seems to ignore the debug drawer.

I'm sorry I keep asking this question, but every time I ask it I never seem to get an answer that actually tells me how. Due to the vagueness of the parameters and the lack of code that really pertains to what I want to use it for, I still don't quite get it. Maybe I should just give up on this dream... :(
Kanttori
Posts: 38
Joined: Thu Jul 08, 2010 12:52 am

Re: I'm afraid I don't quite understand what frames are (6do

Post by Kanttori »

Hi,

The frames are localspace frames as in they always stay in the same position and rotation relative to the object's center. For the special case where you want to constrain an object to movement between two points:
- you need a _worldspace_ transform frameX which is on that line between the points and that has an axis which is parallel to that line. Basicly you need to formulate a valid rotation matrix (no shear, no scale) around this axis.
- if you have that, you can calculate the localspace frames for objects as simple as (inverse of object world transform)*frameX. If you have a localspace frameA for object A and you want to know corresponding frameB; (inverse of object B world transform)*(object A world transform)*frameA,
- note that with 6dof and some other you can also change the object which is used as a reference in solving the constraint, useReferenceFrameA or useLinearReferenceFrameA. Depending on your setup you may need to change it's value.

Hope I'm not confusing more than explaining.
eSalt
Posts: 15
Joined: Tue Jul 19, 2011 4:08 pm

Re: I'm afraid I don't quite understand what frames are (6do

Post by eSalt »

Thank you for helping. I should hopefully have enough information to figure everything out. I can't work on it today though. The AC is out and I got very little sleep last night as a result of the heat.

Even in my current state of mind (dead tired), your explanation of what to do makes a good deal of sense. :D