#include <Spring.h>
Public Member Functions | |
| virtual | ~Spring (void) |
| Spring (RigidBody *body, const float d, const float s0, const ml7::Vector2 &local_point=ml7::Vector2(0.0f), const ml7::Vector2 &other_point=ml7::Vector2(0.0f)) | |
| RigidBody * | get_attached_body () const |
| float | get_spring_constant () const |
| float | get_rest_length () const |
| const ml7::Vector2 & | get_local_point () const |
| const ml7::Vector2 & | get_attached_local_point () const |
| void | set_attached_body (RigidBody *body) |
| void | set_spring_constant (const float d) |
| void | set_rest_length (const float s0) |
| void | set_local_point (const ml7::Vector2 &local_point) |
| void | set_attached_local_point (const ml7::Vector2 &other_point) |
A force generator that applies spring forces to 2d rigid bodies. One instance should not be used for multiple rigid bodies. However, you may attach one instance to a rigid body and apply the same spring force between this rigid bodies and multiple others. Notice that the force generator creates a force for only one object (the rigid body passed in to function update_force). If you want to link two objects with a spring, then you have to individually create and register a generator for each.
| virtual bl7::rigidbodies2::Spring::~Spring | ( | void | ) | [inline, virtual] |
Destructor.
| bl7::rigidbodies2::Spring::Spring | ( | RigidBody * | body, | |
| const float | d, | |||
| const float | s0, | |||
| const ml7::Vector2 & | local_point = ml7::Vector2(0.0f), |
|||
| const ml7::Vector2 & | other_point = ml7::Vector2(0.0f) | |||
| ) | [inline] |
Explicit constructor with parameters specifying the permanently attached rigid body on the other side of the spring, the spring constant d, the rest length of the spring s0 and, finally, the local connection points of the two rigid bodies the spring is attached to.
| RigidBody* bl7::rigidbodies2::Spring::get_attached_body | ( | ) | const [inline] |
Returns the rigid body permanently attached to the spring.
| const ml7::Vector2& bl7::rigidbodies2::Spring::get_attached_local_point | ( | ) | const [inline] |
Returns the local connection point of the permanently attached rigid body.
| const ml7::Vector2& bl7::rigidbodies2::Spring::get_local_point | ( | ) | const [inline] |
Returns the local connection point of the rigid body to apply forces to.
| float bl7::rigidbodies2::Spring::get_rest_length | ( | ) | const [inline] |
Returns the rest length of the spring.
| float bl7::rigidbodies2::Spring::get_spring_constant | ( | ) | const [inline] |
Returns the spring constant.
| void bl7::rigidbodies2::Spring::set_attached_body | ( | RigidBody * | body | ) | [inline] |
Sets the rigid body permanently attached to the spring.
| void bl7::rigidbodies2::Spring::set_attached_local_point | ( | const ml7::Vector2 & | other_point | ) | [inline] |
Sets the local connection point of the permanently attached rigid body.
| void bl7::rigidbodies2::Spring::set_local_point | ( | const ml7::Vector2 & | local_point | ) | [inline] |
Sets the local connection point of the rigid body to apply forces to.
| void bl7::rigidbodies2::Spring::set_rest_length | ( | const float | s0 | ) | [inline] |
Sets the rest length of the spring.
| void bl7::rigidbodies2::Spring::set_spring_constant | ( | const float | d | ) | [inline] |
Sets the spring constant.
1.7.1