Mass to restrict motion in one direction

Posts that don't fit into other categories.
maheshkurmi
Posts: 60
Joined: Tue Mar 27, 2012 7:20 am
Location: India
Contact:

Mass to restrict motion in one direction

Postby maheshkurmi » Fri Oct 13, 2017 2:12 am

What should be that best way to restrict motion of body in particular direction only, I am thinking of two possible solutions..

1. Create new joint (kind of prismatic joint with upper limit set to infinite, other end remains fixed on ground)

2. Create new MassType having infinite mass in direction perpendicular to the allowed movement direction, but obviously mass is scalar so

How should I approach, keeping stability in mind?

I personally prefer creating new MassType, and I am ready to modify dyn4j for this.

William
Site Admin
Posts: 345
Joined: Sat Feb 06, 2010 10:23 pm

Re: Mass to restrict motion in one direction

Postby William » Fri Oct 13, 2017 8:17 pm

Would the direction of allowed motion change? If so, is the change of direction controlled by user input?

I think a valid constraint (Joint) would be the most stable, but that is definitely more effort if made to fit your specific need. You could probably get away with just copying the PrismaticJoint and making a few modifications. I've also seen some talk of a body's motion being constrained to an arbitrary path. Not trivial, but could offer some neat interactions.

A new mass type is probably easier to try out. In this case you would need to consider all the places where the mass is used to make sure the logic to restrict is executed.

William

maheshkurmi
Posts: 60
Joined: Tue Mar 27, 2012 7:20 am
Location: India
Contact:

Re: Mass to restrict motion in one direction

Postby maheshkurmi » Sun Oct 15, 2017 7:47 am

Thanks William ..

I am trying to create a body which is allowed to move vertically or horizontally (predefined directions) .

For example if body can move in vertical direction only, no effect of forces/impulses should be experienced in horizontal direction,
BTW body is free to rotate about center.

Creating new mass type seems to be good idea. Is there something I should keep in mind before doing this?


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest