Scripting random movement (Python)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there, I'm learning how to do Maya scripting and as the title suggests, I'm trying to write a Python script for random movement. The goal is to create a script so that an object is at a different position every 10 frames by giving it's x, y, and z a random value between -5 and 5, thus creating "random" movement.
I am using a for loop that goes from 1 to 10, then multiplying that that number by 10 to get what frame I have to set the keyframe at. The problem is that setKeyframe requires a time or float value, not an int value. I tried converting the number into a float but it was not accepted and I am not sure how to convert it into a time value.
If anyone is can help or offer an alternative solution to create random movement, it would be greatly appreciated.