Skip to content

IgorSokoloff/python_physics_engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

python_physics_engine

Here is the source code of the project in Informatics of 4 semester at MIPT in 2016.

Demonstration video: https://youtu.be/pjhc5iVnPiU

The project contains a 2D physics engine and a program used mathematical apparatus of the engine renders the scene. Programming language: python + pygame. Pygame used for rendering the scene and key events.

Opportunities of the engine:

Generate an unlimited set of scenes with an unlimited number of objects there. Smooth solid balls were used as physical objects. Implemented an algorithm for determining and processing of elastic collision between the balls.

Opportunities of the program:

Generate an unlimited number of balls on the same stage. Features check menu.

Control:

The methods are performed for whole scene:

  • Space - pause
  • B - On / Off border
  • Crt - on / off display velocity vectors
  • Shift - on / off display of acceleration vectors
  • RMB - add a new ball (its parameters are generated randomly)

The methods are performed for the concrete sphere of when you hover the cursor on it

  • Delete - remove the ball from the scene
  • LMB - information output to the console of it
  • LMB + MouseMotion - moving the ball
  • R + MOusewheel - radius change
  • A + MOusewheel - acceleration change
  • V + MOusewheel - speed change
  • F + LMB + MouseMotion - the application of force to a concrete ball
  • M + MOusewheel - mass change

python_physics_engine

В данном репозитории находится исходный код проекта по информатике за 4 семестр МФТИ.

Демонстрационное видео: https://youtu.be/pjhc5iVnPiU

Проект состоит из 2D физического движка и программы, которая задействует математический аппарат движка и отрисовывает сцену. Язык программирования: python + pygame. Pygame использовался в качеcтве средства рендеринга сцены и обработки нажатия клавиш.

Возможности движка:

Генерировать неограниченное множество сцен с неограниченным количеством объектов на ней. В качестве физических объектов участвуют твердые гладкими шарики. Реализован алгоритм определения и обработки упругих столкновений между шариками.

Возможности программы:

Генерировать неограниченное количество шариков на одной сцене. Возможности программы отображатся меню управления.

Управление:

Методы выполняются для всей сцены:

  • space - пауза
  • b - вкл/выкл границы
  • crt - вкл/выкл отображения векторов скорости
  • shift - вкл/выкл отображения векторов ускорения
  • RMB - добавить новую сферу (ее параметры генерируются случайно)

Методы выполняются для конкретной сферы при наведении на нее курсора:

  • delete - удаление сферы со сцены
  • LMB - вывод в консоль информации о ней
  • LMB + MouseMotion - перемещение сферы
  • r + MOusewheel - изменение радиуса
  • a + MOusewheel - изменение ускорения
  • v + MOusewheel - изменение скорости
  • f + LMB + MouseMotion- приложение силы к конкретной сфере
  • m + MOusewheel - изменение массы

About

Computer science course project at MIPT in 2016

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages