Joint problem

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
-=Magic=-
Posts: 41
Joined: Thu Jun 30, 2011 11:32 am

Joint problem

Post by -=Magic=- »

I've a problem building a joint as I need.

I've a box A (W: 4, H: 1, L 6)
I've a box B (W:0.2, H: 0.4, L: 0.6)
I need to put the box B, right under the box A. I need to limit the rotation of box B around his Y axis only. This is the only ratation allowed, for B. (and B should follow all the rotations of the main object A)

I set: CollisionRules.AddRule(boxA, boxB, CollisionRule.NoBroadPhase);

I tried the RevoluteJoint (BallSocket+RevoluteAngularJoint). Box B rotate only around the Y axis... Box B stay under box A.
but I've a side effect... if I rotate the boxA (for example I pitch up the box A of 45°) then box B doesn't follow the same rotation, but stay on his vertical position.

Here an example of what I mean:

Image

what I should add to perform this? (I have the same problem if I Roll A.)

final goal: a slot car (box A), with his paddle (box B). the paddle can only rotate around Y axis, as a flag.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Joint problem

Post by Norbo »

This setup seems to do the trick:

Code: Select all

            Box a = new Box(new Vector3(0, 5, 10), 4, 1, 6, 10);
            Box b = new Box(new Vector3(1.7f, 5.7f, 12), 0.2f, 0.4f, 0.6f, 3);
            CollisionRules.AddRule(a, b, CollisionRule.NoBroadPhase);

            RevoluteJoint joint = new RevoluteJoint(a, b, b.Position + new Vector3(0, -0.2f, -.3f), Vector3.Up);
            Space.Add(a);
            Space.Add(b);
            Space.Add(joint);
-=Magic=-
Posts: 41
Joined: Thu Jun 30, 2011 11:32 am

Re: Joint problem

Post by -=Magic=- »

This is what I tried also.... (anyway, I'll recheck it) :( (with the exception that boxB is a compundshape (box+capsule) as you may see on the screenshots)

if I remember well, with only a revolute joint... the box B fall down due to the gravity...
-=Magic=-
Posts: 41
Joined: Thu Jun 30, 2011 11:32 am

Re: Joint problem

Post by -=Magic=- »

:(

tryed. same effect. boxB rotate around his joint point with the boxA
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Joint problem

Post by Norbo »

I'm not sure what exactly is happening; the sample code posted does work in isolation (if I understood the goal correctly). Could you reproduce the issue in a BEPUphysicsDemos demo (i.e. modify the WallDemo to show the issue)? That way I could easily run and debug to diagnose anything going wrong.
-=Magic=-
Posts: 41
Joined: Thu Jun 30, 2011 11:32 am

Re: Joint problem

Post by -=Magic=- »

actually I'm tesing with bepu demo project. I added a new screen demo.

I'm doing more tests.. later I'll add more infos.
Post Reply