C4D Python vraag

Status
Niet open voor verdere reacties.

tim687

Terugkerende gebruiker
Lid geworden
25 apr 2010
Berichten
1.774
Beste leden,
Ik zit met een klein probleempje, namelijk dat ik een script heb waarmee ik de flaps kan laten bewegen van een jet, maaaarrr
dit doe je door de Rotation.P aan te passen in C4D
Alleen omdat de flaps niet precies op (0,0,0) liggen gaat het punt dat vast moet blijven zitten aan de vleugels ook omhoog.
Dit probeer ik te compenseren en ik ben al een heel eind, alleen ik zit nu echt vast.
Weet iemand (als mijn uitleg duidelijk is) hoe ik dit probleem kan oplossen?

Ik zal het probleem ff tekenen:

Dit gebeurd er nu als hij omhoog komt te staan (ff heel overdreven):
/
__

Je snapt natuurlijk wel dat die ruimte tussen de onderkant van de slash en de rechterkant van de underscore er niet mag zijn.
Hoe kan ik dit oplossen???

Dit is het Python script wat ik tot nu toe heb (als de Rotation-waarde positief is komt de rechter flap omhoog, als de Rotation-waarde negatief is komt de linker flap omhoog):


Code:
import c4d
#Welcome to the world of Python

numerical_types = (
c4d.ID_GV_VALUE_TYPE_REAL, c4d.ID_GV_VALUE_TYPE_INTEGER,
c4d.DA_LONG, c4d.DA_REAL, c4d.DA_LLONG,
)

def main():
    global Rotation
  
     
    
    global RightFlapRotation
    global RightFlapY
    global RightFlapZ
    
    global LeftFlapRotation
    global LeftFlapY
    global LeftFlapZ
     
    if Rotation==0:

        LeftFlapRotation=0   
        LeftFlapY=0                                #DIT IS DE ECHTE Z-AS!!
        LeftFlapZ=0                                #DIT IS DE ECHTE Y-AS!!
    
        RightFlapRotation= 0
        RightFlapY=0                                #DIT IS DE ECHTE Z-AS!!
        RightFlapZ=0                                #DIT IS DE ECHTE Y-AS!!
        
    if Rotation >0:                                #RECHTER FLAP GAAT OMHOOG
      
      LeftFlapRotation= 0-Rotation
      LeftFlapY=Rotation*3.141592654                #DIT IS DE ECHTE Z-AS!!
      LeftFlapZ=10.333-(-1*Rotation)-10.333         #DIT IS DE ECHTE Y-AS!!
      
      RightFlapRotation=Rotation
      RightFlapY=-10.333+(Rotation*-3.141592654)    #DIT IS DE ECHTE Z-AS!!
      RightFlapZ=0-(1*Rotation)+1                   #DIT IS DE ECHTE Y-AS!!
      
     
     
    if Rotation <0:                                #LINKER FLAP GAAT OMHOOG
                        
            LeftFlapRotation=-0-Rotation
            LeftFlapY=Rotation*3.141592654               #DIT IS DE ECHTE Z-AS!!
            LeftFlapZ=10.333-(-1*Rotation)+1             #DIT IS DE ECHTE Y-AS!!
                  
            RightFlapRotation= Rotation
            RightFlapY=-10.333+(Rotation*-3.141592654)   #DIT IS DE ECHTE Z-AS!!
            RightFlapZ=0-(1*Rotation)+1                  #DIT IS DE ECHTE Y-AS!!
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan