_
This commit is contained in:
parent
e112ce52e3
commit
be4d8e0ff9
@ -22,12 +22,13 @@ class RopeInteractiveDot:
|
||||
|
||||
if clicked:
|
||||
for object_batch in self.scene.get_i_objects():
|
||||
rmp = object_batch[1] # relative mouse position
|
||||
for object_ in object_batch[0]:
|
||||
if object_.__class__.__name__ == "Rope":
|
||||
for node in object_.nodes:
|
||||
if node.locked is False:
|
||||
if math.sqrt(sum((node.position - self.position) ** 2)) < self.forcefield_range:
|
||||
force_vector = node.position - self.position
|
||||
if math.sqrt(sum((node.position - rmp) ** 2)) < self.forcefield_range:
|
||||
force_vector = node.position - rmp
|
||||
full_force_vector = (force_vector / math.sqrt(sum(force_vector ** 2))) \
|
||||
* self.forcefield_range
|
||||
force_vector = full_force_vector - force_vector
|
||||
|
@ -2,7 +2,6 @@ from numpy import array as a
|
||||
|
||||
from UI.Objects.Multiscene import Multiscene
|
||||
from UI.Objects.nr_objects.Line import Line
|
||||
from UI.Objects.nr_objects.controllable_objects.RopeInteractiveDot import RopeInteractiveDot
|
||||
from UI.Scenes.RopeScene import RopeScene
|
||||
|
||||
|
||||
@ -20,9 +19,6 @@ class RopeMultiscene(Multiscene):
|
||||
|
||||
l0 = Line(a([200, 0]), a([200, 400]), 10, (255, 100, 100), self)
|
||||
|
||||
rd0 = RopeInteractiveDot(a([0, 0]), 10, (100, 255, 100), 20, 100, self)
|
||||
#self.nrc_objects.append(rd0)
|
||||
|
||||
self.sort_objects(s0, s1, l0)
|
||||
|
||||
self.i = 0
|
||||
|
@ -11,7 +11,7 @@ import time
|
||||
|
||||
|
||||
screen_size = a([200, 500])
|
||||
scene = RopeMultiscene(screen_size)
|
||||
scene = RopeScene(screen_size)
|
||||
|
||||
mouse_pos = [0, 0]
|
||||
clicked = False
|
||||
|
Loading…
Reference in New Issue
Block a user