Wednesday, 5 June 2024

learning exercise – animating explosions / projectiles with code and physics



Velocity: v0=v×(1+random.uniform(−rv,rv))v0=v×(1+random.uniform(−rv,rv))
Mass: mass=m×(1+random.uniform(−rm,rm))mass=m×(1+random.uniform(−rm,rm))
Launch Angle: random.uniform(0,360)random_angle=random.uniform(0,360)
Mess with time (bit slow to process but things look bad if not slowed down for aesthetics):
Δt=0.1speed_factor×(1+random.uniform(−time_randomize_bias,time_randomize_bias))Δt=speed_factor0.1×(1+random.uniform(−time_randomize_bias,time_randomize_bias))
Bias Launch Direction:.
angle_variation=(1−direction_bias)×90angle_variation=(1−direction_bias)×90 and
random_angle=random.uniform(launch_angle−angle_variation,launch_angle+angle_variation)random_angle=random.uniform(launch_angle−angle_variation,launch_angle+angle_variation).
Air Resistance: (1−air_resistance×Δt (delta t) /randomized_mass)
Blender testing – any 3d program really - :