提交 a40da510 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 ebb77ef3
......@@ -6,8 +6,8 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from bodies import Moon, Earth, Body
from objs import Football
from bodies import Earth
from objs import create_rock
from common.consts import SECONDS_PER_HOUR, SECONDS_PER_MINUTE
from sim_scenes.func import ursina_run, get_vector2d_velocity, camera_look_at, two_bodies_colliding
from simulators.ursina.entities.body_timer import TimeData
......@@ -25,10 +25,11 @@ def create_ejected_object(velocity, raduis, trail_color, gravity_only_for, angle
"""
# 根据速度、角度获取矢量速度(vx、vy) -> vx² + vy² = velocity²
vx, vy = get_vector2d_velocity(velocity, angle=angle)
football = Football(name=f'物体速度:{velocity}', mass=500, size_scale=1e3, trail_color=trail_color,
rock = create_rock(name=f'物体速度:{velocity}', mass=500, size_scale=1e3, trail_color=trail_color,
init_position=[0, raduis, 0],
init_velocity=[vx, vy, 0], gravity_only_for=[gravity_only_for]) # 仅适用于地球的重力,物体之间重力不要受到影响
return football
init_velocity=[vx, vy, 0],
gravity_only_for=[gravity_only_for]) # 仅适用于地球的重力,物体之间重力不要受到影响
return rock
if __name__ == '__main__':
......@@ -36,7 +37,9 @@ if __name__ == '__main__':
抛物线模拟
"""
# 地球在中心位置
earth = Earth(init_position=[0, 0, 0], size_scale=1, texture="earth_hd.jpg", init_velocity=[0, 0, 0])
earth = Earth(init_position=[0, 0, 0], init_velocity=[0, 0, 0],
rotate_angle=0, rotation_speed=0,
size_scale=1, texture="earth_hd.jpg")
raduis = earth.raduis + 300
# TODO: 4个不同的抛出速度 7.5km/s、8.5km/s、10km/s、11.2km/s(第二宇宙速度)
# 粉色:velocity = 7.5,飞不出地球太远,就落地
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册