Chipmunk class
Chipmunk class
new()Initialize the simulation space
Chipmunk$new(gravity = cpv(0, -100), time_step = 0.01)get_static_segments()Get the data.frame of all current segments Add a circular body to the space
add_circle()add_box()Chipmunk$add_box(
x,
y,
vx = 0,
vy = 0,
width = 1.73,
height = 1,
angle = 0,
radius = 0.05,
angular_velocity = 0,
mass = 1,
friction = 0.7,
elasticity = 0
)x, yinitial body location
vx, vyinitial body velocity
width, heightbody width and height
anglerotation angle in degrees. default 0
radiusradius of rounded corner
angular_velocitydefault: 0 degrees/second
massmass of body. default: 1
frictiondefault: 0.7
elasticitydefault: 0 (no bounce). Valid range [0, 1]
get_boxes_as_polygons()Get the location of all the boxes as a list of corner vertices Add a convex hull polygon to the space
add_polygon()Chipmunk$add_polygon(
xs,
ys,
angle = 0,
x = 0,
y = 0,
vx = 0,
vy = 0,
radius = 0.05,
angular_velocity = 0,
mass = 1,
friction = 0.7,
elasticity = 0
)xs, yspolygon vertices
angleinitial rotation angle in degrees. default 0
x, yinitial body location
vx, vyinitial body velocity
radiusradius of rounded corners
angular_velocitydefault: 0 degrees/second
massmass of body. default: 1
frictiondefault: 0.7
elasticitydefault: 0 (no bounce). Valid range [0, 1]