ScriptSpot

Forum topic · General Scripting

Problem in Constrain scripting

By jabermax2 · 2014-01-28

Description

Hi:
I try to write position constrain by script,we have a Box001 and a Point001
the script is this

/*
b= $Box001
ptHelper = $Point001

b.position.controller = position_list()
b.position.controller.available.controller = position_constraint()
b.position.controller.setActive 2
b.position.controller.setName 2 "Constraint: Position"
b.position.controller["Constraint__Position"].appendTarget ptHelper 100

/*

this work fine but i need, instead of (b)for example adding pick button to take
box001 then refer (b) to that value would anyone help please.

Comments (3)

Thanks

jabermax2 · 2014-01-29

Hi
Thanks so much,i am new with this site,it was the first time sb help this quick .thanks again. it was exactly what i was looking for to write "stretchy bone".

Thanks alot

jabermax2 · 2014-01-29

Hi
Thanks so much it was exactlly what i was looking for to write "stretchy bone".

.

miauu · 2014-01-28

Use the buttons to pick the objects. The object picked with "Pick object 01" will be constrained to the object picked with "Pick object 02" button.


(
	global rol_
	try(destroyDialog rol_)catch()
	rollout rol_ ""
	(
		local obj01 = undefined
		local obj02 = undefined
		
		pickbutton btn_01 "Pick object 01"
		pickbutton btn_02 "Pick object 02" 
		button btn_start "Add constrain" 
		
		on btn_01 picked obj do obj01 = obj
		on btn_02 picked obj do obj02 = obj
		on btn_start pressed do
		(
			obj01.position.controller = position_list()
			obj01.position.controller.available.controller = position_constraint()
			obj01.position.controller.setActive 2
			obj01.position.controller.setName 2 "Constraint: Position"
			obj01.position.controller["Constraint__Position"].appendTarget obj02 100
		)
	)
	createdialog rol_ 
)