How to create a ("Beacon") circle beam

Post Python examples to help other users.
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

How to create a ("Beacon") circle beam

Postby Tuck » Tue Nov 20, 2012 4:45 am

Credits for this snippit goes to freddukes.

Method to achieve points in a circle:

Syntax: Select all

def get_points(radius, origin, steps = 12, horizontal = True):
points = []
increment = 2 * pi / steps
for index in range(steps):
theta = increment * index
x_offset = cos(theta) * radius + origin.x
if horizontal:
y_offset = sin(theta) * radius + origin.y
z_offset = origin.z
else:
y_offset = origin.y
z_offset = sin(theta) * radius + origin.z
points.append((x_offset, y_offset, z_offset))
return points


Syntax: Select all

points = get_points(radius, origin) #radius how big should the circle be around Origin
for x, y in enumerate(points):
start_point = y
end_index = x + 1
if end_index == len(points):
end_index = 0
end_point = points[end_index]
effects.Beam(Shared.Vector(*start_point), Shared.Vector(*end_point),
model, model, frameStart, frameRate, time, width,
endWidth, fadeLength, noise, red, green, blue, alpha, speed)
-Tuck

Return to “Code examples / Cookbook”

Who is online

Users browsing this forum: No registered users and 19 guests