Python Script for ISS Orbitals
-
The script as is, is configured to have a full day’s orbital for the ISS in 240 frames.
-
A full days orbitals of the ISS consists of 15.5 orbits per day.
-
Script caps total frames to 5000
Here is the python script below
# @TRUEMODELOFTHEWORLD
# https://concaveearth.net/t/simple-iss-orbitals-inside-of-the-concave-earth-with-python-source-code/548
#
import bpy
import math
def create_iss_orbit():
# Clear existing objects
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)
# Add a sphere to represent Earth
bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 0))
earth = bpy.context.object
earth.name = "Earth"
# Add a smaller sphere to represent the ISS
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.05, location=(1.2, 0, 0))
iss = bpy.context.object
iss.name = "ISS"
# Set up animation parameters
total_frames = 5000 # Total frames for extended animation
frames_per_day = 240 # 240 frames represent one full day
orbits_per_day = 15.5 # ISS completes ~15.5 orbits per day
total_days = total_frames / frames_per_day
# Add keyframes for the ISS to simulate an inclined orbit
orbit_inclination = math.radians(51.6) # Approximate inclination of the ISS in degrees
orbital_radius = 1.2 # Distance of ISS from Earth's center
for frame in range(total_frames + 1):
# Calculate time elapsed in days
time_in_days = frame / frames_per_day
# Calculate the orbital angle for the current frame
angle = 2 * math.pi * orbits_per_day * time_in_days
# Calculate the position in the inclined orbit
x = orbital_radius * math.cos(angle)
y = orbital_radius * math.sin(angle) * math.cos(orbit_inclination)
z = orbital_radius * math.sin(angle) * math.sin(orbit_inclination)
# Set the ISS location for the current frame
iss.location = (x, y, z)
iss.keyframe_insert(data_path="location", frame=frame)
# Set scene settings
bpy.context.scene.frame_start = 0
bpy.context.scene.frame_end = total_frames
# Run the script to create the ISS orbit animation
create_iss_orbit()