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, y
initial body location
vx, vy
initial body velocity
width, height
body width and height
angle
rotation angle in degrees. default 0
radius
radius of rounded corner
angular_velocity
default: 0 degrees/second
mass
mass of body. default: 1
friction
default: 0.7
elasticity
default: 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, ys
polygon vertices
angle
initial rotation angle in degrees. default 0
x, y
initial body location
vx, vy
initial body velocity
radius
radius of rounded corners
angular_velocity
default: 0 degrees/second
mass
mass of body. default: 1
friction
default: 0.7
elasticity
default: 0 (no bounce). Valid range [0, 1]