Animating a robot arm from computer keyboard?

Hello every one, this is a great comunity congrats!

Mi problem is :
I have a arm with a Pen atribute holder the action is simple.
In the max value (100) of the slider, the arm is open and instead in the min value (0) the arm is close.

I need control this from my computer keyboard so, if i press a preassigned key like(k)the arm value increment one point each time i press to open.

and if press(j)key the arm close each time i press to the minimun value 0

I hope you can helpme
thanks you

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
br0t's picture

That is possible, although

That is possible, although through MAXScript you can only check a few keys, I think ctrl, shift, alt. But you can of course assign macroscripts to any button, e.g. the left-arrow and right-arrow.

It could work like this, if you assign the macroscripts to one button each:

macroscript robotArm_increase
category:"robotArm"
(
	if selection.count == 1 do
	(
		local obj = selection[1]
 
		local maxVal = 100
		local step = 0.1
		-- increase value
		obj.modifiers["PEN_Attribute_Holder 2"].yourCustomAttributesName.yourPropertyName += step
		-- reset if > max value
		if obj.modifiers["PEN_Attribute_Holder 2"].yourCustomAttributesName.yourPropertyName > maxVal do 
			obj.modifiers["PEN_Attribute_Holder 2"].yourCustomAttributesName.yourPropertyName = maxVal
	)--end if	
)
 
macroscript robotArm_decrease
category:"robotArm"
(
	if selection.count == 1 do
	(
		local obj = selection[1]
 
		local minVal = 0
		local step = 0.1
		-- decrease value
		obj.modifiers["PEN_Attribute_Holder 2"].yourCustomAttributesName.yourPropertyName -= step
		-- reset if < min value
		if obj.modifiers["PEN_Attribute_Holder 2"].yourCustomAttributesName.yourPropertyName > maxVal do 
			obj.modifiers["PEN_Attribute_Holder 2"].yourCustomAttributesName.yourPropertyName = maxVal
	)--end if	
)

You will have to edit the script to make it work. You can find the name of your custom attribute definition and property by expanding the modifier in the curve editor. Also the modifier name has to match. I guess the rest is self-explaining.

Cheers

Never get low & slow & out of ideas

belfe's picture

thanks br0t

awesome way to assign the steps of the buttons! with macro scripts =) brilliant!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.