Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Keeping the code "active"

    PYTHON Development
    0
    3
    536
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 18/02/2011 at 07:38, xxxxxxxx wrote:

      Hi folks,

      I was wondering how to keep the code active, so to say.

      Means that it does not only initialize but is active every frame.

      I just want a random movement over time for one particle.

      Here is the Code (sorry it's in german for personal learning purposes)

      import c4d
      import random

      stepSize = 5
      tp.AllocParticles(1)

      v_vector = c4d.Vector()

      v_vector.x = float(0)
      v_vector.y = float(0)
      v_vector.z = float(0)

      z=0

      def haupt(z,v_vector) :
        while z<10000 :
            direction = random.randrange (0,8,1)
            zufallsrichtung (direction)
            tp.SetPosition(0, v_vector)
            z += 1
            print direction
        return direction

      def zufallsrichtung (direction) :

      if direction == 0:  # Norden
            v_vector.y += stepSize

      elif direction == 1: # Nordost
            v_vector.x += stepSize
            v_vector.y += stepSize
         
        elif direction == 2: # Ost
            v_vector.x += stepSize

      elif direction == 3: # Südost
            v_vector.x += stepSize
            v_vector.y -= stepSize

      elif direction == 4: # Süd
              v_vector.y += stepSize

      elif direction == 5: # Südwest
            v_vector.x -= stepSize
            v_vector.y -= stepSize

      elif direction == 6: # West
              v_vector.x -= stepSize;

      elif direction == 7: # Nordwest
              v_vector.x -= stepSize;
              v_vector.y += stepSize;

      def main() :
        pass

      haupt(z,v_vector)

      Hope someone can help me out of this tiny problem

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 19/02/2011 at 15:37, xxxxxxxx wrote:

        Haha, I've already replied you at tutorials.de. 😉
        You passed the main-function

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 22/02/2011 at 02:32, xxxxxxxx wrote:

          Yes that was the problem, thank you very much 😃

          1 Reply Last reply Reply Quote 0
          • First post
            Last post