PDA

View Full Version : Real-time Sine Node


theyoda3
09-24-2010, 08:11 PM
How do I create a real-time sine wave node?
1) Ideally this has no input, but if it must use an input it would be system time in milliseconds ( not the time-line ).
2) The output is calculated by the equation y = sin( x ), where x is time and y is the amplitude of the wave.
3) The node always evaluates in real-time without dependency on the time-line.
4) If you connect an object, such as a sphere, and use the output of the node to control the z-translation of the object it will rise and fall in real-time, without dependency on the time-line.

Does anyone have any suggestions on how to create this type of real-time sine wave node?

Thanks,
Chris

nathansims100
09-24-2010, 09:34 PM
Hi, There's an example in the API documentation of just this. Link
(http://download.autodesk.com/us/maya/2010help/API/sine_node_8py-example.html)

theyoda3
09-24-2010, 09:55 PM
Thanks, there is an example of the same plug-in using the C++ API, but neither of them have a real-time evaluation of sine. By real-time, I mean if you connect an object's translation to the ouput it will move based on the sine function regardless of the time slider. I need the node to continuously evaluate and never stop.

-Chris

surreal-reality
10-11-2010, 11:54 PM
Sounds like you may need a scriptjob for that, something that evaluates constantly on maya's end, that way whatever input gets thrown it's way through your computers timing etc gets updated all the time.

tonytouch
10-12-2010, 09:23 AM
1) Ideally this has no input, but if it must use an input it would be system time in milliseconds ( not the time-line ).

hm , i would say , the input range would be somewhere between -pi and +pi , as sin is a triangular-function ..... anway , you could implement a multiplier in the node , for the input , and another multiplier for the amplitude .

anyway , it is indeed quite easy to programm :

2 references:
http://www.3dbuzz.com/xcart/product.php?productid=54
or if you are subscription-maya-user , you can get this one for free
http://store.autodesk.com/DRHM/store?Action=DisplayProductDetailsPage&SiteID=adsk&Locale=en_US&productID=108270000

in both , there is shown , how to create an API_plugin with python.

tonytouch
10-12-2010, 09:26 AM
if you want to have some sort of time-slider independent interaction , then i it might be possible to use the "time" module in python , and not connect the MTime . but i am not sure , why you would want to have it indepently from the timeSlider .

Robert Bateman
10-12-2010, 10:24 AM
By real-time, I mean if you connect an object's translation to the ouput it will move based on the sine function regardless of the time slider. I need the node to continuously evaluate and never stop.

Maya is not designed to work this way. Write your own app to do this. Any attempts you make to implement this in Maya are guaranteed to fail. You're attempting to code an abomination.... I hope you have no intention of using on a multi-core system? Or god forbid - rendering!

if you want to have some sort of time-slider independent interaction , then i it might be possible to use the "time" module in python , and not connect the MTime .

No. It just isn't possible. When you refer to 'Time Slider Interaction' what you really mean is 'change the value of time1.outTime'. It doesn't matter what node you get your input from, it just has to be a node..... You could create your own 'SystemTime' node, but for gods sake don't start building anything serious on top of it.......

hm , i would say , the input range would be somewhere between -pi and +pi , as sin is a triangular-function

So you're suggesting that 720 degrees is an invalid input for sin()? I don't think I agree with you on that....

CGTalk Moderation
10-12-2010, 10:24 AM
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.