-
Notifications
You must be signed in to change notification settings - Fork 191
Description
Hi,
I'm trying to simulate the collision between two segments, s1 and s2, which have the same shape. The initial positions of s1 and s2 are p1 = Vec2d(100, 100) and p2 = Vec2d(150, 92), respectively. Their initial angles are a1 = np.pi / 2 for s1 and a2 = -np.pi for s2. The elasticity and gravity for both segments are set to 0. The initial scenario is shown below.
simulation_steps_3
s2 approaches s1 using two methods. The first method involves setting the velocity of s2 (v2) to Vec2d(-0.5, 0) at the first step (agents[1].body.velocity = Vec2d(-0.5, 0.)). The second method involves applying an impulse to s2 with the code agents[1].body.apply_impulse_at_world_point(Vec2d(-1.0, 0), agents[1].body.position) at the first step.
After a few steps, the segments collide. Initially, when s1 and s2 collide, I check the total_impulse and total_ke of the system, which are (0, 0) and 0, respectively. These values remain unchanged until the positions of the two segments are as shown in the following figure.
simulation_steps_106
At this step, the two contact points obtained from the collide_handler are [100.0, 100.0] and [101.5, 100.0]. Subsequently, the segments separate from each other, resulting in the final scenario depicted below.
simulation_steps_108
I wonder why this happen? Do you have any pointers for me?
Thank you!