[Closed] height cylinder controlled by current object
Top view
cylinder height varies with sphere selected position
how can i do this? thanks in advance
if you would do it manually you can wire the sphere’s Position parameter and the chylinder Height parameter.
with max script it looks like:
--delete objects
--c = cylinder radius:10 wirecolor:orange
--s = sphere radius:2 isselected:on wirecolor:green
paramWire.connect s.pos.controller[#Z_Position] c.baseObject[#Height] "Z_Position"
if you want to use relative position the best way is to link them both to the same parent or group them (what is almost the same):
g = group #(c,s)
g.pivot = c.pivot
setGroupOpen g on
ok, now if i want that the cs(cyl-sphere obj) reach the position of another new sphere? let say i have a sphere creator in xyz position and the cs object reach the position of the new sphere when i press the cs creator script.
thanks again
I think that your question is not very clear Andreseloy ! Or at least I cannot figure out what you want to achieve !
do you want to align the violet ball to the cyan and brown balls? could you draw how the cylinder has to look like after the alignment?
(the video you posted my player can’t play)
So, you want both sphere&cylinder to move to a <NewSphere>’s position. Maybe
doing the following ?
s.parent = c
c.pos = <NewSphere>.pos
yes but for sure dont now how t use it…i was looking your previous help to me in the target and addtarget issue but only recently i noted that when you put the “target” in creation of the obj you have the look at autocatically there…
i really apreciated your effort Denis and also thanks acca88
delete objects
a = cylinder radius:5 height:30 wirecolor:orange
b = point pos:[0,0,30] wirecolor:green
c = a.rotation.controller = lookat_constraint upnode_ctrl:0 target_axis:2
c.appendTarget b 100
s = a.height.controller = float_script()
s.addobject "source" (NodeTransformMonitor node:a)
s.addobject "target" (NodeTransformMonitor node:b)
s.setexpression "distance source target"
that code dont do what i want …
this code was shared by Denis long time ago in some of my thread about vectors…
i made a little modification at the end of the code,i made first a new sphere(new obj) and then i press the button script and the position is in the new obj…i move the sphere to other pos and the cylnder follow to the new position but create another cylinder…
(
(
(
spot= Geosphere name:"Spot" radius:5
cylSpot = Cylinder radius:2 target:spot
cylSpotHeight = float_script()
cylSpotHeight.addTarget #pos spot[#transform][#position]
cylSpotHeight.setExpression "-length pos"
cylSpot.height.controller = cylSpotHeight
$Spot.pos = $.pos --added by me
)
)
)
sorry Denis,please look the video because was not my intention to be rush(barrier language+3dmaxscipt ignorance=misunderstandig very frenquently).