Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Community Answers

  1. jed's post in Collision without losing energy was marked as the answer   
    An XP version is probably going to be non dynamic.
     
    Here's a Python sim -
     

     
    if you want the sphere to roll, you'll need Roll It or equivalent
     
    sph2.c4d
     
    Roll-It 2020 EN – eggtion.net 
  2. jed's post in Bounding Box Hierachy in Python/Xpresso was marked as the answer   
    Rad and bounding box work a bit differently -
     
    rad returns size along object x, y, z (result doesn't change when obj rotates)
     
    bounding box returns size along scene axis (result changes when obj rotates)
     
    here top is the parent null containing 3 objects
     
    import c4d from c4d import utils def main(): global x, y, z mg = top.GetMg() result = utils.GetBBox(top, mg) # returns 2 vector tuple >> center position and radius of bounding box radius = result[1] x = radius.x * 2.0 y = radius.y * 2.0 z = radius.z * 2.0  
     
    bounding box 3 objects.c4d
     
    Bounding Box position can sometimes give the 'wrong' result.
  3. jed's post in Nodes - Cloner Object Disappearance was marked as the answer   
    Sort of - but it's a bit flaky. You can use the standard hierarchy path to go up/down etc using a reference node.
     

     
    I just used D to go down one level from sphere to figure, then similar XP as the radius to control the figure height. I tried using scale, but it exploded.
     
    Object Disappearance_0002.c4d
  4. jed's post in Dynamically scale and move cubes within a grid was marked as the answer   
    Was it this
     

     
    Divider_demo_scene.c4d
     
    Divider plugin.zip
  5. jed's post in Random Seed based on index was marked as the answer   
    A bit like this 😀
     
    py_balloons.c4d
  6. jed's post in Constraint tag min/max was marked as the answer   
    Use 2 tags.
  7. jed's post in Motion of connected objects (loops and arrows) was marked as the answer   
    XPresso method
     
    rotor.c4d
  8. jed's post in Xpresso C4D question was marked as the answer   
    Here's a compare node set to >=. It gives a 1 or True when frame is >= 30.
     

  9. jed's post in Xpresso C4D question was marked as the answer   
    Here's a compare node set to >=. It gives a 1 or True when frame is >= 30.
     

  10. jed's post in Xpresso C4D question was marked as the answer   
    Here's a compare node set to >=. It gives a 1 or True when frame is >= 30.
     

  11. jed's post in XPRESSO - Select child by index was marked as the answer   
    Try this
     
    show.c4d
  12. jed's post in If else Loop was marked as the answer   
    I think this does it
     
    def main(): global Output1 # n is number of mats for a in range(n): if Input1 >= Input2 * a and Input1 < Input2 * (a + 1): Output1 = a  
  13. jed's post in Not sure where to start on Animating a Pump Jack was marked as the answer   
    Here I used xpresso to rotate the lower object and dynamics to push the rest
     

     
     
    pump 4.c4d
  14. jed's post in increment a stored value by 1 each frame was marked as the answer   
    Writing to user data and reading it back is one way to store and increment a value, although there's sometimes a 1F delay in reading it back. 
     
    Since you know coding, why not use a python node, something like
     
    import c4d #Welcome to the world of Python def main(): global x frame = doc.GetTime().GetFrame(doc.GetFps()) # get current frame if frame == 0: x = 50 # start value else: if Input1: # bool input x += 1  
    This is evaluated every frame, but will increment when you click in the viewport - which is annoying. The fix is to check Frame Dependent so only calculates on new frame. 
  15. jed's post in Get Boundingbox / Size of Cloner was marked as the answer   
    Try GetRad()
     
    getrad.c4d
  16. jed's post in Generating Number Sequences Using MoGraph with "00" before numbers was marked as the answer   
    Assuming you're using Noseman's method of getting the text from the name, it's possible if you use python zfill and make the cloner editable -
     

     
    import c4d #Welcome to the world of Python def main(): global Output1 Output1 = Input1.zfill(3)  
    zfill pads a string with zeros up to the max character count in brackets.
     
    zfill.c4d
     
    Noseman's method - Generating Number Sequences Using MoGraph in Cinema 4D - YouTube
  17. jed's post in Xpresso setup breaks when animating Sweep was marked as the answer   
    I put the sweeping in the iteration
     
    xpresso_setup_issue_0001.c4d
  18. jed's post in Collision trigger/sensor system issues was marked as the answer   
    My (expandable) python solution -
     
    sensors under a null, using hierarchy + a ref node (down)
    same in Python GetDown() = down
     
    lister is an empty list where 0 = target not hit, 1 = target hit
     
    for loop iterates through the cloners and if a target is hit, puts a 1 in the relevant place in lister
     
    now test if there's a 1 anywhere in lister > light up cursor thing
     
    py 1.c4d
  19. jed's post in Constraint tags in Python was marked as the answer   
    Here's a workaround. I used GetTags() and specified which tag I wanted.
     
    Here I set a cone as the parent of the cube. I just dragged the fields into the window and did some editing. Some fields seem to have numerical names.
     
    def main(): obj = doc.SearchObject('Cube') obj2 = doc.SearchObject('Cone') tag = obj.GetTags()[0] # assuming constraint is 1st tag tag[c4d.ID_CA_CONSTRAINT_TAG_PARENT] = 1 # enable parent tag[30001] = obj2 # Cone is parent  
    there's probably a correct way to do this 😀
  20. jed's post in Parameter and Object equality of value was marked as the answer   
    I'm not sure I understand the problem, but if it's to move the object manually (reflected in slider) and also move by slider, then a memory node set to 1F can detect value change ie is value != previous.
     
    slidervsvalues_0001.c4d
  21. jed's post in Help converting C.O.F.F.E.E. to Python was marked as the answer   
    I don't understand your scene, but I've translated the code. Things move and there's no error messages 😀
     
    import c4d import math def main(): global Out_NE, Out_NW, Out_SE, Out_SW Range = 20 / math.sqrt(2) Dist_NE = abs(-In_X -In_Y + 20) / math.sqrt(2) Dist_NW = abs(In_X -In_Y + 20) / math.sqrt(2) Dist_SE = abs(-In_X + In_Y + 20) / math.sqrt(2) Dist_SW = abs(In_X + In_Y + 20) / math.sqrt(2) Perc_NE = 1 - (Dist_NE / Range) Perc_NW = 1 - (Dist_NW / Range) Perc_SE = 1 - (Dist_SE / Range) Perc_SW = 1 - (Dist_SW / Range) if Perc_NE > 0: Out_NE = Perc_NE else: Out_NE = 0 if Perc_NW > 0: Out_NW = Perc_NW else: Out_NW = 0 if Perc_SE > 0: Out_SE = Perc_SE else: Out_SE = 0 if Perc_SW > 0: Out_SW = Perc_SW else: Out_SW = 0  
     
    180524-facelkjaf_5-coffee_script_0001.c4d
     
     
  22. jed's post in Help converting C.O.F.F.E.E. to Python was marked as the answer   
    I don't understand your scene, but I've translated the code. Things move and there's no error messages 😀
     
    import c4d import math def main(): global Out_NE, Out_NW, Out_SE, Out_SW Range = 20 / math.sqrt(2) Dist_NE = abs(-In_X -In_Y + 20) / math.sqrt(2) Dist_NW = abs(In_X -In_Y + 20) / math.sqrt(2) Dist_SE = abs(-In_X + In_Y + 20) / math.sqrt(2) Dist_SW = abs(In_X + In_Y + 20) / math.sqrt(2) Perc_NE = 1 - (Dist_NE / Range) Perc_NW = 1 - (Dist_NW / Range) Perc_SE = 1 - (Dist_SE / Range) Perc_SW = 1 - (Dist_SW / Range) if Perc_NE > 0: Out_NE = Perc_NE else: Out_NE = 0 if Perc_NW > 0: Out_NW = Perc_NW else: Out_NW = 0 if Perc_SE > 0: Out_SE = Perc_SE else: Out_SE = 0 if Perc_SW > 0: Out_SW = Perc_SW else: Out_SW = 0  
     
    180524-facelkjaf_5-coffee_script_0001.c4d
     
     
  23. jed's post in Simple stop motion system was marked as the answer   
    The reason why != worked is that visible input port is
     
    0 = on
    1 = off
    2 = default
     
    in this file I used == and a condition node to switch 0/1 - a bit more logical. Also I divided the frame to adjust the speed.
     
    lego-man.zip
  24. jed's post in Calculate highest number from set of variables and generate text was marked as the answer   
    Here's some ideas for you - 11 nodes 😀
     
    lights.c4d
     
    iteration is designed to do the same math on any number of objects.
  25. jed's post in Interpolating Values of Parameters Over Time was marked as the answer   
    I made this a while ago, so it uses the old sound effector (still works in R21). The python sums previous (adjustable) frames and averages them
     
    import c4d def main(): global list1, average_level # outputs must be global, list1 must persist to next frame frame = doc.GetTime().GetFrame(doc.GetFps()) # get current frame if frame == 0: list1 = [] # make empty list list1.append(level_in) # add input to end of list every frame while len(list1) > stack_size: # delete 1st item when list reaches limit (stack size) del list1[0] b = sum(list1) # add all items in list1 average_level = b / stack_size # divide total for average, len() = length # ---------------------------------------  
    cafe.zip
×
×
  • Create New...