Telescopic antenna help

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  07 July 2013
Telescopic antenna help

I am wanting to create an antenna exactly like the one in this video:
where a larger tube only extends when a smaller tube is fully extended. Any ideas how I would go about doing this? So far I have tried set driven keys as well as parent constraints with different weights. But I haven't been able to get this effect. The video seems to be on expressions but I wasn't really able to learn anything as it is in Russian .

Any help is greatly appreciated.
  07 July 2013

You might want to look into making a setup where joint scaling drives geo scaling via some kind of math equation and joint parenting drives the locations of the geos.

Maybe an animator control can drive an overall length and that length is used to figure out how to scale each of the joints. Check out Jason Schleifer, Aaron Holly stretchy rigs

Here is some rough math i did there probably are some mistakes but hope its helpful. There probably are builtin easier ways to get a number between two extremes that meets those extremes depending on another number (maybe remap value nodes, hermite, clamp )

How to get a number x between scale 0 and 2 that depends on curveLength y between 0 and 10.
call lengths l1 = 0, l2 = 10. scales s1=0, s2 = 2,

x = s2 when y = l2
x = s1 when y = l1

equation for line
x = my + b
s2 = m*l2 + b
s1 = m*l1 + b
m*(l2-l1) = (s2-s1)

m = (s2-s1)/(l2-l1)
b = s2 - (s2-s1)*l2/(l2-l1)

plugin in the m and b from above
x = my + b ( l1 < y < l2 )
x = s2 ( y >= l2 )
x = s1 ( y <= l1 )
is one way to get a number x between 0 and 2 that depends on curveLength y between 0 and 10 (call lengths l1 = 0, l2 = 10. scales s1=0, s2 = 2)

Here is some Python code i wrote to do this

  getScaleInBoundUsingLengthBound(curveLength = 13.0, lengthBound = [10.0,15.0], scaleBound = [0.0,2.0] )slope 0.4, intercept -4.0
  # Result: 1.2 # 
  getScaleInBoundUsingLengthBound(curveLength = 15.5, lengthBound = [10.0,15.0], scaleBound = [0.0,2.0] )slope 0.4, intercept -4.0
  # Result: 2.0 # 
  #one way to get a number x between scale 0 and 2 that depends on curveLength y between 0 and 10.
  #should get linear interpolation between scale bounds with zeroes outside of length bound
  #ex: call lengths l1 = 0, l2 = 10.   scales s1=0, s2 = 2,  
  def getScaleInBoundUsingLengthBound( curveLength = 0.0, lengthBound = [0.0,10.0], scaleBound = [0.0,2.0]  ):
  	l1 = lengthBound[0]
  	l2 = lengthBound[1]
  	s1 = scaleBound[0]
  	s2 = scaleBound[1]
  	if( (l2 - l1) > 0 ):
  		m = (s2-s1)/(l2 - l1) #would error if no length
  		b  = s2 - (s2-s1)*l2/(l2-l1)
  		print 'slope %s, intercept %s \n' %(m,b)
  		y = curveLength
  		if( y < l2 and y > l1):
  			x = m*y + b
  		elif( y >= l2):
  			x = s2
  		elif( y <= l1):
  			x = s1
  	return x
  07 July 2013
Wow this is pretty awesome thank you very much for going to all this trouble for me . Gonna implement it right now.
  07 July 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 12:11 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.