Expresso to solve tire rotation.
Posted: 24 May 2012 01:39 PM   [ Ignore ]  
Total Posts:  13
Joined  2010-01-19

Hey all,
I know this is kind of a complex question but thought I would shoot it out there anyway.  I have modeled a planter for planting crop and it has different sizes of wheels and I need to find a way to calculate the rotation of each wheel of its distance.  I am sure this would be possible using expresso for best and most accurate results just have no idea how to set something like this up.  My only other option at this time would be to do it by hand… Let me know if you have any ideas on this.

Thanks!

Profile
 
 
Posted: 24 May 2012 01:48 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
Total Posts:  987
Joined  2011-03-03

Hi QAgraphics,

it is a returning question and my favorite idea is so far to use the “Previous Global Position” and the “Global Position” to get the needed distance and then the rotation from frame to frame. This in relation to the diameter (PI) of the wheel and you get the rotation. I guess that part is not in question.  You might use the distance for all, if no curve is driven, or calculate for each wheel/tire a new one.

This results in a frame by frame calculation, which might will not work for Motion Blur! If that is needed and not working otherwise you need to turn this expression into an Motion/Animation Clip. Check the data if it works smooth for MB and you are ready to go.


I hope that helps

All the best
Sassi

 Signature 

My newest Music Video with lots of Camera-Projection/Mapping: http://youtu.be/fYNJd9QGHGo  Platinum Award at the 46th WorldFest Houston, TX, USA

Profile
 
 
Posted: 25 May 2012 05:26 AM   [ Ignore ]   [ # 2 ]  
Total Posts:  13
Joined  2010-01-19

Hey Sassi,
Thanks for the reply.  I did some more digging into more methods and actually found this.  Might be helpful for some people to see another solution.

File Attachments
Rotation wheels Different Sizes.zip  (File Size: 160KB - Downloads: 53)
Profile
 
 
Posted: 25 May 2012 07:11 AM   [ Ignore ]   [ # 3 ]  
Total Posts:  21
Joined  2007-03-27

Please see example below if it helps.

Cheers
Lennart

# simpleWHEEL Python example by tcastudios.com@2011
#
# Copy and paste all this to a Python Tag attached to an Object to be rotated (Pitch).
# Place the Object Under a parent. Move the parent :)

import c4d
from c4d import Vector 
as v

#  Stored position
lastpos v(0)

def main():
    global 
lastpos

    
#  Check for parent to drive the roll
    
wheel op.GetObject()
    if 
not wheel.GetUp():
        return 
False

    
# Set the radius
    
radius  200

    
# Get Parent info
    
parent    wheel.GetUp()
    
parentm   parent.GetMg()
    
parentpos parentm.off

    
# Check if Lastpos memo
    
if not lastpos:
        
lastpos parentpos

    
# Get the Last position as a local value
    
lastpos = ~parentm lastpos

    
# Calculate the rotation using Lastpos z vector as delta (distance)
    
rot lastpos.z/radius

    
# Set the new rotation by adding new rotation to old rotation
    
wheel[c4d.ID_BASEOBJECT_ABS_ROTATION,c4d.VECTOR_Y] wheel[c4d.ID_BASEOBJECT_ABS_ROTATION,c4d.VECTOR_Y] rot

    
# Store Parent position
    
lastpos parentpos 
 Signature 

R13 | OSX | http://tcastudios.com

Profile
 
 
Posted: 25 May 2012 07:20 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
Total Posts:  987
Joined  2011-03-03

Hey QAgraphics,

You’re welcome. Nice of you to think on others. It might be helpful, but my intention here is that people try to solve it on their own, a reason why I do not suggest so often plug ins, it creates in my perspective only dependency. This idea follows relatively my suggestion from above, which I did many years ago for the PXC.
If you have to rely on other peoples solutions, you can’t change them as quick as it would be your own that you change. To create your own solution sets you free. As this is Cineversity, I hope people check this out and try to rebuild from memory! (Not just copy it) The more one is creating such things, the more s/he will be more efficient in his environment and with that more successful. This is certainly my target here.

Base:80 (to give the credit he deserves) is the author of your attached file and certainly a well accepted source of solutions.

Have a great weekend

Sassi

 Signature 

My newest Music Video with lots of Camera-Projection/Mapping: http://youtu.be/fYNJd9QGHGo  Platinum Award at the 46th WorldFest Houston, TX, USA

Profile