You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
anchorPoint is too basic. It's difficult to use for attachments like Spine, or physics objects like rag dolls, cars, rope bridges, chains, ...
A joint provides three pieces of information:
The anchor point on body A
The anchor point on body B
The type of joint (weld, axel, slide, etc)
The joint is its own class, and it references the bodies (and their anchor points) and type of joint. The joint class could also have its own physics properties, like strength (the amount of force required to turn an axel, or bend a weld...)
me.Body references a list of joints.
I can envision a rag doll created with me.Container, and all of its children (renderables for the body parts) are attached to one another using axel (rotary) joints. Seems like a pretty simple way to use it.
i'm not familiar with joints, so excuse my question, but would this be used to defined how shapes are attached to a body, or how shapes are related to each other ? also would this apply to how we use anchorpoint today for the position of renderable compared to a object body ?
For a more general explanation, this is how bodies can be connected to one another. A really simple example is a 2D car. It contains three bodies:
The car chassis, which can be car-shaped, or even just a simple rectangle.
The front wheel.
The rear wheel.
And this car also contains two joints:
The axel that connects the front wheel to the chassis.
The axel that connects the rear wheel to the chassis.
The axel joint allows the bodies to rotate in relation to one another. A weld is a "strong" attachment that prevents bodies from moving in relation to one another (a lot like how anchorPoint works today). A slide joint allows bodies to slide a minimum and maximum distance from one another, etc.
My hope is that we can use these joints to customize how renderables attach to entities and so on. They will be a lot more customizable than anchorPoint is today, because a joint needs TWO anchorPoints; one on each body. Whereas anchorPoint today is a unit value relative to Entity, and it's implied to always be the upper-left corner of the renderable.
Activity
obiot commentedon Dec 5, 2014
i'm not familiar with joints, so excuse my question, but would this be used to defined how shapes are attached to a body, or how shapes are related to each other ? also would this apply to how we use anchorpoint today for the position of renderable compared to a object body ?
parasyte commentedon Dec 6, 2014
I'll refer you to the Chipmunk documentation for an explanation of joint in Chipmunk terms: http://chipmunk-physics.net/release/ChipmunkLatest-Docs/#cpConstraint-Shapes
For a more general explanation, this is how bodies can be connected to one another. A really simple example is a 2D car. It contains three bodies:
And this car also contains two joints:
The axel joint allows the bodies to rotate in relation to one another. A weld is a "strong" attachment that prevents bodies from moving in relation to one another (a lot like how
anchorPointworks today). A slide joint allows bodies to slide a minimum and maximum distance from one another, etc.My hope is that we can use these joints to customize how renderables attach to entities and so on. They will be a lot more customizable than
anchorPointis today, because a joint needs TWO anchorPoints; one on each body. WhereasanchorPointtoday is a unit value relative to Entity, and it's implied to always be the upper-left corner of the renderable.Does this make sense?