- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a Script for a point with a Path constraint that determines the coordinates of the point for several different values of percent. The script should be capable of changing the percent value as a function of its world location.
For example, given pointB with a Path constraint to line1 three points locations are to be output then the value of s (percent) is determined by whichever distance is greater p0 to p1, or p1 to p2.
For this code:
self.position.controller.percent = 0.0
p0 = self.position
self.position.controller.percent = 0.15
p1 = self.position
self.position.controller.percent = 0.25
p2 = self.position
format ("\n\n p0 = %, p1 = %, p2 = %") p0 p1 p2
d1 = length(p1 - p0)
d2 = length(p2 - p1)
format ("\n d1 = %, d2 = % ") d1 d2
if (d1 < d2) then
(s = 0.15)
else
(s = 0.25)
s
The output to the Max Listener is:
p0 = [0,0,0], p1 = [0,0,0], p2 = [0,0,0]
d1 = 0.0, d2 = 0.0
p0 = [1244.75,1807.58,758.997], p1 = [1244.75,1807.58,758.997], p2 = [1244.75,1807.58,758.997]
d1 = 0.0, d2 = 0.0
p0 = [24.895,36.1515,15.1799], p1 = [24.895,36.1515,15.1799], p2 = [24.895,36.1515,15.1799]
d1 = 0.0, d2 = 0.0
p0 = [0,0,0], p1 = [0,0,0], p2 = [0,0,0]
d1 = 0.0, d2 = 0.0
p0 = [1244.75,1807.58,758.997], p1 = [1244.75,1807.58,758.997], p2 = [1244.75,1807.58,758.997]
d1 = 0.0, d2 = 0.0
p0 = [0,0,0], p1 = [0,0,0], p2 = [0,0,0]
d1 = 0.0, d2 = 0.0
p0 = [1244.75,1807.58,758.997], p1 = [1244.75,1807.58,758.997], p2 = [1244.75,1807.58,758.997]
d1 = 0.0, d2 = 0.0
p0 = [24.895,36.1515,15.1799], p1 = [24.895,36.1515,15.1799], p2 = [24.895,36.1515,15.1799]
d1 = 0.0, d2 = 0.0
p0 = [0,0,0], p1 = [0,0,0], p2 = [0,0,0]
d1 = 0.0, d2 = 0.0
p0 = [1244.75,1807.58,758.997], p1 = [1244.75,1807.58,758.997], p2 = [1244.75,1807.58,758.997]
d1 = 0.0, d2 = 0.0
p0 = [24.895,36.1515,15.1799], p1 = [24.895,36.1515,15.1799], p2 = [24.895,36.1515,15.1799]
First, why are there 10 sets of output? I would expect only 1 set.
The values output for p0, p1, p2 are all over and not consistent. Why?
How can I captures the world location of PointB for multiple values of percent?
Solved! Go to Solution.