简体   繁体   中英

How to "nail" a dynamic body?

So, what I want to achieve is to have the body's center of masses in a static position, but freely rotating. Like it's nailed to a wall or something

Tried to look at joints, but that doesn't feel right...

I personally didn't work with that one before but the Revolute Joint looks like what you are searching for.

The revolute joint can be thought of as a hinge, a pin, or an axle. An anchor point is defined on each body, and the bodies will be moved so that these two points are always in the same place, and the relative rotation of the bodies is not restricted. Revolute joints can be given limits so that the bodies can rotate only to a certain point. They can also be given a motor so that the bodies will try to rotate at a given speed, with a given torque. Common uses for revolute joints include: wheels or rollers, chains or swingbridges (using multiple revolute joints), rag-doll joints, rotating doors, catapults, levers

In your mentioned setup I expect the wall to be body A and body B is pinned to it like in this example:

来自 iforce2d.net 的旋转关节示例

https://www.iforce2d.net/b2dtut/joints-revolute

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM