Hi ...
I'm curious about the expression script because I rarely use it, only once in a while ...
such a simple case :
dist = ( distance $.pos $sphere001.pos )
$.pos.z += dist
my question is :
how to write '$.pos' itself into expression of postion script controller ?
thanks
By
Comments (4)
Comment policy
Try this one
sph = $Sphere001
tea = $Teapot001
ctrl = float_script ()
tea[3][1][3].track = ctrl
ctrl.addConstant "fixPos" (tea.pos)
ctrl.AddObject "trgObj" sph
ctrl.AddNode "srcObj" tea
ctrl.script = "(distance trgObj.pos fixPos)"
hi barigazy, thank you .. its working correctly :)
but I'm still confused about expression script.
I saw some scripts from the other scriptor its same/closest case.
if some user deleting the target object is will getting error (some problem)
mm .. so I'm looking for to fixing that's error
a snippet method, such as:
it's working but it's making move the object(tea) to zero z position,
as I want the object(tea) position do not impact anything when the target has been deleted.
z position should stay on current z position.
any suggestion ?
Create one more Constant "fixTrgPos" which will represent starting target position
like I did for source object
if isValidNode trgObj then (distance trgObj.pos fixPos) else (distance fixTrgPos fixPos)
nicely :)I did what you
nicely :)
I did what you said...
but it's almost close to the goal.
with your method it works if the target(sphere) has not moved.
but when the target has been moved and the user deletes the target then the source(teapot) position still moving to another place.
I need the source position must be in the same place when the target erased, at any time in which the target has moved or not.
thank you again barigazy
regards