Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.8 kB
0
Indexable
Never
import bpy

# Create a new scene
scene = bpy.data.scenes.new('Boat Scene')

# Set the background color
scene.world.horizon_color = (0.23, 0.45, 0.81)

# Add a camera to the scene
camera = bpy.data.cameras.new('Boat Camera')
camera_obj = bpy.data.objects.new('Boat Camera', camera)
scene.collection.objects.link(camera_obj)
camera_obj.location = (0, -25, 10)
camera_obj.rotation_euler = (1.5708, 0, 0)

# Add a light to the scene
light = bpy.data.lights.new('Boat Light', 'POINT')
light_obj = bpy.data.objects.new('Boat Light', light)
scene.collection.objects.link(light_obj)
light_obj.location = (0, 0, 20)

# Create the hull shape
bpy.ops.mesh.primitive_cylinder_add(radius=3, depth=7, location=(0, 0, 3.5))
hull = bpy.context.active_object
hull.name = 'Hull'

# Create the deck shape
bpy.ops.mesh.primitive_plane_add(size=14, location=(0, 0, 4.5))
deck = bpy.context.active_object
deck.name = 'Deck'

# Create the cabin shape
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, -3.5, 5))
cabin = bpy.context.active_object
cabin.name = 'Cabin'

# Create the bench seat shape
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 3.5, 2))
bench = bpy.context.active_object
bench.name = 'Bench Seat'

# Create the motor shape
bpy.ops.mesh.primitive_cone_add(radius1=1, radius2=0, depth=2, location=(0, 0, 1))
motor = bpy.context.active_object
motor.name = 'Motor'

# Set the materials for each object
hull.data.materials.append(bpy.data.materials.new('Hull Material'))
hull.data.materials[0].diffuse_color = (0.6, 0.6, 0.6)

deck.data.materials.append(bpy.data.materials.new('Deck Material'))
deck.data.materials[0].diffuse_color = (0.8, 0.8, 0.8)

cabin.data.materials.append(bpy.data.materials.new('Cabin Material'))
cabin.data.materials[0].diffuse_color = (0.9, 0.9, 0.9)

bench.data.materials.append(bpy.data.materials.new('Bench Material'))