-
Posts
2,189 -
Joined
-
Last visited
-
Days Won
66
Community Answers
-
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
-
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.
-
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
-
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
-
jed's post in Motion of connected objects (loops and arrows) was marked as the answer
XPresso method
rotor.c4d
-
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.
-
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.
-
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.
-
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
-
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
-
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.
-
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
-
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
-
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
-
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 😀
-
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
-
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
-
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
-
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
-
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.
-
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