Obscene oscillation with... WeldJoint?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
snoozbuster
Posts: 172
Joined: Sat Sep 24, 2011 7:31 am

Obscene oscillation with... WeldJoint?

Post by snoozbuster »

So, the title kinda says it all. I set up a few entities (which all use collision data generated from the same model), attach a WeldJoint to each of them, hook an event to make them obliterate any boxes that touch them, and let them run free. There are six of these in total, and all of them but the first have this obscene oscillation to them. The first one is even in the same machine with another, but the first is the only one totally unaffected by this. I use the same two BaseModel declarations to initalize all six (just ditching the old reference when I've added it to a machine), but that shouldn't be an issue (and if it was, the the second one would work fine, too). Do you have any idea what's going on? The WeldJoint initialization is just like the other ones I've made, which is:

Code: Select all

foreach(BaseModel m in models)
            {
                WeldJoint j = new WeldJoint(null, m.Entity);
                j.IsActive = true;
                joints.Add(j);
            }
If I don't add the WeldJoints, the models just fall forever cause of gravity, so it's WeldJoint based. If I hook entity.CollisionInformation.Events.InitialCollisionDetected with a method that removes boxes from the space, do I even need them to withstand collision? Actually, what's even better would be being able to hook an event that denotes collision, but not actually collide with anything (these are lasers, and that's usually what lasers do), preferrably without using CollisionGroups, because that would be require a couple more collision groups and rules, which I'd like to avoid. Thanks for your help!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Obscene oscillation with... WeldJoint?

Post by Norbo »

The WeldJoint uses a BallSocketJoint and NoRotationJoint. The WeldJoint, being a convenience combo-joint, auto-configures these subjoints. So, the BallSocketJoint's anchor is just placed at the midpoint between the connected entities' centers. The 'world' entity used when a null connection is passed in is positioned at (0,0,0). So, it is likely that the anchor is very far away from the dynamic object.

By having the anchor so far away, solving becomes substantially more difficult and oscillations are more likely.

To avoid this, set the BallSocketJoint's offset to zero.

However, since this is connected to the 'world' entity through the null parameter, a WeldJoint will just behave like a SingleEntityLinearMotor and SingleEntityAngularMotor. It might be a good idea to just use the single-entity versions directly.
snoozbuster
Posts: 172
Joined: Sat Sep 24, 2011 7:31 am

Re: Obscene oscillation with... WeldJoint?

Post by snoozbuster »

That did in fact fix it, but I would like to know what configuration would make them collide but not collide, like a ghostly laser. That is, it fires a method when collision would normally happen, but then doesn't collide.

Also, are joints affected by mass? I have a collection of objects with a total mass of probably 200, and the joint attached to the base of it just kinda sags pathetically and doesn't really work. I assume increasing the damping would fix this? (EDIT: yes, and yes)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Obscene oscillation with... WeldJoint?

Post by Norbo »

I would like to know what configuration would make them collide but not collide, like a ghostly laser. That is, it fires a method when collision would normally happen, but then doesn't collide.
This sounds like you want to detect contact points, but not respond to them. That can be done by defining a rule between objects of CollisionRules.NoSolver.
snoozbuster
Posts: 172
Joined: Sat Sep 24, 2011 7:31 am

Re: Obscene oscillation with... WeldJoint?

Post by snoozbuster »

Alright, thanks.
Post Reply