Get the current numeric PERCENT value from a "path constraint float script

Get the current numeric PERCENT value from a "path constraint float script

truckexpert
Advocate Advocate
742 Views
4 Replies
Message 1 of 5

Get the current numeric PERCENT value from a "path constraint float script

truckexpert
Advocate
Advocate

How do I get the current numeric PERCENT value from a "path constraint float script?

 

Thanks.

Dave

 

SYSINFO

Dell Precision 7920 Tower
BaseBoard 060K5C
Intel Xeon Silver 4110 CPU @ 2.10GHz, 2095 Mhz, 8 Core(s), 16 Logical Processor(s)
NVIDIA Quadro P1000 - Adapter RAM (1,048,576) bytes
Physical Memory (RAM) 32.0 GB
Windows 10 Pro

3DS Max 2021

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes
Accepted solutions (1)
743 Views
4 Replies
Replies (4)
Message 2 of 5

denisT.MaxDoctor
Advisor
Advisor

@truckexpert wrote:

How do I get the current numeric PERCENT value from a "path constraint float script?

 


what is "path constraint float script"?

I know "path constraint" and "float script" ... what are they together?  

Message 3 of 5

truckexpert
Advocate
Advocate

Thank you for your reply.

Assume a dummy named "Dummy1" is moving along a spline path named "Path1". 

      I am controlling the percent progress of Dummy1 along the spline (length L) using a "float script" controller, so as to allow the user to specify the speed, so that %Dist = speed*time/L.   I simply want the script to print the current value of the percent progress (along with time and distance) to create a table in the listener window as the script runs, but I don't know it's name (it isn't %Dist) or how to refer to it. 

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes
Message 4 of 5

denisT.MaxDoctor
Advisor
Advisor
Accepted solution
delete objects
p = circle name:#path radius:30 wirecolor:green
t = teapot name:#source radius:5 wirecolor:orange
c = t.pos.controller = path_constraint path:p follow:on
s = c.percent.controller = float_script()
s.addconstant #velocity 0.5
s.addconstant #period 4.0
s.addconstant #debug false

ss  = ""
ss += "local value = sin (period * F) * velocity\n"
ss += "if debug do format \"frame:% secs:% period:% velocity:% == value:%\\n\" F S period velocity value\n"
ss += "value\n"

s.setexpression ss


(
	s.setconstant #debug on
	for t = 0 to 100f by 10 do at time t 
	(
		format "\t% >> percent:%\n" t c.percent
	)  
	s.setconstant #debug off
)

 

Use this as an example. Of course, the #debug option should be disabled in real time and should be used with data output (check, debug).

0 Likes
Message 5 of 5

truckexpert
Advocate
Advocate

Thank you again!! I have learned a lot from the above script. You obviously have finessed the art of Maxscript programming!

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes