pymunk

Pymunk/Chipmunk2d - dynamic bodies colliding with static bodies generating collsion impulses

∥☆過路亽.° 提交于 2021-02-11 12:40:26
问题 simple question, but couldn't find an answer: Can static bodies apply collision impulses to dynamic bodies? here's a little recording of what my code does As you can see, the two dynamic triangles collide with each other, and are stopped by the static line. however, the behavior is not what I want. If I had only one triangle, it would be skidding down the ledge on just one vertex --> the static body does not inflict any sort of torque or counter forces (I'm no physicist) on the triangles.

Pymunk/Chipmunk2d - dynamic bodies colliding with static bodies generating collsion impulses

北城余情 提交于 2021-02-11 12:39:19
问题 simple question, but couldn't find an answer: Can static bodies apply collision impulses to dynamic bodies? here's a little recording of what my code does As you can see, the two dynamic triangles collide with each other, and are stopped by the static line. however, the behavior is not what I want. If I had only one triangle, it would be skidding down the ledge on just one vertex --> the static body does not inflict any sort of torque or counter forces (I'm no physicist) on the triangles.

Side scrolling with Pymunk and Pygame. How to move the camera / viewport to view only part of the world?

笑着哭i 提交于 2020-01-02 08:40:08
问题 From the pymunk examples I've seen that there's a difference between the pymunk coordinates and pygame coordinates. Also, that pymunk is meant just for the 2D physics, while pygame is for rendering objects/sprites on the screen. So when searching for how to build an environment where the camera follows the player, people (including me) end up getting confused. I've seen the examples here, here, here and here (even surprised that nobody answered this), but given the number of questions related

Error with pymunk space.remove method

走远了吗. 提交于 2019-12-24 16:15:30
问题 I have a ball generator, that "generates" and adds balls(circles) to the simulation. The ball is to be removed when it hits a static poly in list s_boxes . This is done by a collision handler ball_wall_collision . The Error: The following pop-up window does what it's name says, it pops-up My code: Ball Generator class BallGenerator: def __init__(self, min_y, max_y, x): self.min = min_y self.max = max_y self.x = x self.counter = 0 def bowl(self, balls): global ball_bowled y = random.randint

How do I assign values to a variable with a schedule function in pyglet?

耗尽温柔 提交于 2019-12-13 05:10:01
问题 With the following code x=1.0 def update(dt): space.step(dt) def xprinter(self, x): print (x) return x+1 if __name__ == "__main__": x=pyglet.clock.schedule(xprinter,x) pyglet.clock.schedule_interval(update, 1.0/60) pyglet.app.run() My return is simply 1.0 over and over. I would like for the value to be updated with each call. What am I missing? 回答1: The design here is based on that your function rely on returning a result. Which causes a problem because Pyglet's internal functions are in

Using Pymunk with Pyinstaller

喜你入骨 提交于 2019-12-12 04:25:46
问题 I have literally found nothing googling that could help. Even for py2exe but I would like to use pyinstaller. My problem is the module (pymunk[aka Chipmunk]) is not fully included in the exe build. It is probably missing some kind of dll. Basically its missing a dependency I don't know how to solve. Failed to load pymunk library. This error usually means that you don't have a compiled version of chipmunk in the correct spot where pymunk can find it. pymunk does not include precompiled

How to make “compound” shapes in pymunk?

喜夏-厌秋 提交于 2019-12-11 03:36:03
问题 As the title says, How can I join/constraint 2 pymunk bodies/shapes so that they don't they act as one single object?? For example, in this case, I have a cricket bat, made up of 2 separate bodies and polys. I want to join the bat's "handle" to my bat's "blade", So that I get a bat-like object. My code: ### BAT n Co. ### # body format: [vertices, offset, position, mass] bat_bodies_v = [ # bat [[[0, 34], [4, 34], [4, 0], [0, 0]],(-2,-20),(103,190),20], # handle [[[6, 90] , [0, 32] , [0, 17],

Pygame collision code

蓝咒 提交于 2019-12-11 02:05:26
问题 First of all, I have to say that I'm french (so that you understand why I make all these mistakes lol) I'm working on a physic game with python, pygame and pymunk : A ball (I'll call it X) will have to reach a Y point. It's a platformer 2d game. To help the ball reach that Y point, the user will have to add balls (right-click) and to make shapes to help the X move. But... When I discovered (very recently, after I've started to code) the existence of classes and methods, and sprites in pygame,

Pymunk servo joint

一世执手 提交于 2019-12-02 05:52:26
问题 How do you implement a "servo" joint in Pymunk? I'm trying to create a simple model where a box is balanced on a single thin "leg" below it. I've been able create a box and join it to the ground using a PinJoint, but there doesn't seem to be any way to control the angle where the join attaches to the box. I want to be able to specify the angle of attachment. None of the other joints seem to support this. They all seem to be passive joints, with the exception of the SimpleMotor joint, but even

Pymunk servo joint

岁酱吖の 提交于 2019-12-02 02:34:40
How do you implement a "servo" joint in Pymunk? I'm trying to create a simple model where a box is balanced on a single thin "leg" below it. I've been able create a box and join it to the ground using a PinJoint , but there doesn't seem to be any way to control the angle where the join attaches to the box. I want to be able to specify the angle of attachment. None of the other joints seem to support this. They all seem to be passive joints, with the exception of the SimpleMotor joint, but even that is only a constant spinning joint that you can't control. I've managed to cobble something