PDA

View Full Version : Tape Returns 100 for .length value :/


Joel Hooks
02-03-2005, 03:17 PM
I am trying to wire/link the length of my tape object to the usercount value of a counter text object. The tape's value is always changing, but it returns the value of 100 in the wire, and also returns 100 in the listener when I ask for $DisTape.length

What gives? I am sure I am missing something totally obvious, but it is really holding me back from getting my work done!

Joel Hooks
02-03-2005, 04:52 PM
tape is useless for this purpose. It doesn't "store" the value.

Bobo
02-03-2005, 07:50 PM
tape is useless for this purpose. It doesn't "store" the value.

This is not exactly true.

What you are accessing with .length is the ParamBlock value displayed in the rollout as "Length". It is not updated dynamically. If you check "Specify Length", you will see that the .length is actually 100. This internal "specified" value never changes when the tape length changes, as it is needed in the cases "Specify Length" is checked.

BUT all targeted objects in Max, including Target Lights, Cameras and the Tape helper expose a property called .targetDistance which returns exactly the value you need, and update it dynamically. Note that this property is linked to the availability of a target object and is NOT a property of the object itself.

For example,


theTape = tape()
$Tape:Tape02 @ [0.000000,0.000000,0.000000]

theTape.targetDistance
undefined

theTape.target = TargetObject pos:[100,200,300]
$Target:Target01 @ [100.000000,200.000000,300.000000]

theTape.targetDistance
374.166


Surprisingly, ALL 3ds max nodes can have a target - this is a left-over from MAXScript in MAX 2.0 when assigning to the .target property assigned an old-style, pre R4 LookAt controller to the node!

tp = Teapot()
$Teapot:Teapot01 @ [0.000000,0.000000,0.000000]
tp.target
undefined
tp.target = TargetObject pos:[-100,-200,-300]
$Target:Target02 @ [-100.000000,-200.000000,-300.000000]
tp.targetDistance
374.166
classof tp.transform.controller
lookat


The Lookat class is normally HIDDEN since R4 and is there only for backwards compatibility. It is a full transformation controller, while the new (R4+) LookAt Constraint is just a Rotation controller.

So by assigning to the .target property of max nodes, you can assign an obsolete controller and make them look at other objects with their -Z axis... :)

Gumtoo
02-06-2005, 01:58 AM
this thread remind me that i still didn't make any performance test for both lookat controllers.
now it's done.

those scripts give me those results :

rotation lookat controller :
for i = 1 to 100 do
(
local a = point pos:[i*10,0,0]
local b = point pos:[i*10,100,0]
a.rotation.controller = lookAt_constraint() a.rotation.controller.constraints.appendTarget b 100
a.rotation.controller.lookat_vector_length = 0
)

ShowFPS = ~=500 FPS
and if i put a translation key on all 'a' point 50 FPS




for i = 1 to 100 do
(
local a = point pos:[i*10,0,0]
local b = point pos:[i*10,100,0]
a.target = b
)

ShowFPS = ~=500 FPS
and if i put a translation key on all 'a' point 55 FPS

so as i though the 'old' lookAt is a bit faster.

interesting to see that if i put a translation key on all 'b' point ( targets ) instead of 'a' points ,both performances tests results a 5 FPS dropping.


a performance maniac ...

Joel Hooks
02-07-2005, 02:02 PM
BUT all targeted objects in Max, including Target Lights, Cameras and the Tape helper expose a property called .targetDistance which returns exactly the value you need, and update it dynamically. Note that this property is linked to the availability of a target object and is NOT a property of the object itself.

Sweet, thanks BOBO. I had already hit magicm up for a scripted solution, but that is exactly what I was looking for. Gotta love those hidden gems.

CGTalk Moderation
02-07-2006, 03:00 PM
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.