Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
repository:cat_toy [2020/04/02 00:14] porcaro1 [Cat Toy] |
repository:cat_toy [2020/04/02 00:46] porcaro1 [Cat Toy] |
||
---|---|---|---|
Line 52: | Line 52: | ||
- (Optional 1): Add a linear damping effect to your system with a damping coefficient (c). | - (Optional 1): Add a linear damping effect to your system with a damping coefficient (c). | ||
- (Optional 2): Make your system into a vertical mass-spring system and include the force of gravity in your calculations. | - (Optional 2): Make your system into a vertical mass-spring system and include the force of gravity in your calculations. | ||
+ | {{ :repository:cattoy.png?nolink|}} | ||
===Working Code=== | ===Working Code=== | ||
<code Python [enable_line_numbers="true", highlight_lines_extra="0"]> | <code Python [enable_line_numbers="true", highlight_lines_extra="0"]> | ||
Line 101: | Line 101: | ||
| | ||
Fspring=-1*k*s*Lhat | Fspring=-1*k*s*Lhat | ||
- | Fnet=Fspring | + | Fnet=Fspring #(Linear damping)# -c*block.p/block.mass |
| | ||
block.p = block.p + Fnet*dt | block.p = block.p + Fnet*dt |