Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by jed

  1. Try this version - has separate XPresso and a slider for distance trigger https://www.dropbox.com/s/n0zy9glqwgw1aqz/distance_trigger.c4d?dl=0
  2. The problem is the way you are deriving the trigger ie comparing 2 vector positions to be equal. The XPresso window is evaluated once every frame, and for your method to work, the 2 objects must line up exactly when the frame changes. Although one object may pass directly through the 2nd, it won't be registered as a hit unless this happens on the frame. The 2nd circle is not in the right place to trigger. I think you were just lucky with the 1st circle placement. If you move the 1st circle slightly, it will increase in size but not lock. You should rewite the XP from scratch using 'distance less than' as the trigger event. I'm not sure why my file above didn't work for you. The first file I posted had a mistake, and later on I replaced it with version 2. Did you use the new file ? Anyhow, if you can spell out exactly what you want your system to do, I'll write some new code.
  3. You've only got one flip flop + freeze to control multiple objects. Also I think your vector == vector is a bit precise. I'd go for distance less than a small value to trigger the event. I came up with this as a possible workaround. If you use the previous position of your trigger object to determine if the trigger is approaching the circles or moving away, then rangemap the circles radius only on approach, you can use iteration and lock the values on 'exit'. https://www.dropbox.com/s/8wphaealp9rbv9y/previous2.c4d?dl=0 The other alternative is to have separate XPresso for each object. I've sometimes had to do that. If you copy and paste each 'unit', the various links are retained (duplicating by click drag doesn't do this).
  4. Not sure I understand what you're aiming for, but you can use a FlipFlop to latch a value. I put a FF in your XPresso with a F=0 reset. When the freeze activates, it stays on. https://www.dropbox.com/s/fxb72k1nohr6uu9/flipflop_latch.c4d?dl=0
  5. The UK press seem a bit obsessed at the moment with optical illusions - often animated gifs (usually just click-bait). I sometimes have a go at recreating them in Photoshop or C4D. This one I 'solved' today uses iteration, so might interest XPresso users. Just a bit of fun really - use front view. https://www.dropbox.com/s/q7widmpjxjuhs4m/gif_thing.c4d?dl=0
  6. The XPresso window is evaluated every frame, so I'm reading the previous position % and writing a new value once per frame.
  7. If you create the spline movement by adding a small amount to the position every frame, by varying the amount you can control the speed. In this file there's a control slider, and the speed is constant up to 300F then slows to stop at 450F. It's keyframed, so you can tweak the acceleration in the timeline. Thanks for watching my video. https://www.dropbox.com/s/agpdrqvqfeizl2y/slow_down.c4d?dl=0 sorry about DropBox - I've run out of upload space at the Cafe
  8. In my original file, for some reason I selected one cube and followed it round. In 2 places the axis flipped, but being a cube it wasn't noticable. Depending on your scene, I thought it might be a problem. I just selected all the aligns and dropped the rail (copy) in the rail field which fixed it.
  9. @Andybaumgar Just realised you might need to add a rail spline. It's not obvious with the cubes, but if you use an asymmetrical object like a cone, you'll see that the objects flip when moving. In this file the cones flip, but if you drop the rail spline in the align field they all behave. https://www.dropbox.com/s/u7k3vq78qrfehs9/flip.c4d?dl=0
  10. Strictly speaking, I should have set the tag node type to align to spline, not all (there's a massive list). you should buy one of these never Google your own name . . .
  11. XPresso tank track with hierarchy align to spline tag https://www.dropbox.com/s/4f1jvjunz4tw2s2/tank_track.c4d?dl=0 sorry about DropBox - I've run out of upload space.
  12. The Math:Add node, with datatype set to string will join the 2 (or more) string inputs to make one string output (like + for concatenation in Python). The LHS of the XPresso window also has handy system presets such as right string, length string etc.
  13. I've got a little python script that I use for smoothing stuff. Try putting the python node (and the control) between strength and the rest of your code. It subtracts the output from the input and adds a % (say 10-25%) of the difference to the output, so the output approaches the input in a smooth fashion. There's a slider for smooth amount. In this demo I use the Y of two text objects to show the input + output levels and noise to simulate the sound file. https://www.dropbox.com/s/7vonrndaqvt7734/smoother.c4d?dl=0.
  14. jed

    Python lists

    Counting 0, 1, 2, 0 etc is modulo. I think this does what you want, but the timeline must be running (or F > 0) https://www.dropbox.com/s/p3ilwgb56lzifvm/python_modulo.c4d?dl=0 button is bool input, count is output def main(): global previous, count frame = doc.GetTime().GetFrame(doc.GetFps()) # get current frame if frame == 0: previous = 0 count = 0 if previous != button: # if previous not equal to current count = (count + 1) % 3 # increment, % is modulo previous = button
  15. A quick Google tells me that there's no case in Python, and that folk use if/elif or dictionaries. Meanwhile, here's a GoTo joke.
  16. Not sure I understand the question, but I don't think you need the brackets. My precedence cheat sheet - Highest precedence ( ) (anything in brackets is done first) ** (exponentiation) -x, +x *, /, %, // +, - relational operators: <, >, <=, >=, !=, == logical not logical and logical or Lowest precedence also this one is handy time = doc.GetTime().Get() # get current time frame = doc.GetTime().GetFrame(doc.GetFps()) # get current frame
  17. You might find ny Python for noobs tutorial amusing - it's a random lottery number generator link. Given the time of year, maybe my Merry Xmas tubular bells machine merits a plug also link . Runs on Python and Nitro4D's SoundFX.
  18. You'd think that after using round, that the int would be unnecessary, but I had problems with a complete revolution sometimes showing 360 not 0. Using int and round seemed to fix this. Might have been a floating point thing - sometimes FP math gives unexpected results. The modulo operator and negative numbers is also interesting - I tried replicating the code in XPresso and got different results. Modulo means get the highest number divisible by the modulo, then calculate the remainder. Eg for -20 deg modulo 360 : XPresso says the highest number divisible by 360 is 0, so -20 % 360 = -20 Python says the highest number divisible by 360 is -360, so -20 % 360 = 340 [well this is my analysis of it] so Python gives the number you wanted without any extra math. You might want to google output formatting to adjust your output decimal places. https://www.dropbox.com/s/hrdvki6q9i3fr6k/modulo_anomaly.c4d?dl=0
  19. Try this - 2 lines of Python https://www.dropbox.com/s/5eqe7b0f5hhaif5/header_angle_python.c4d?dl=0
  20. jed

    Video Christmas Card

    Here's my video contribution to Xmas - a seasonal tune played on my tubular bells rig. Python/XPresso breakdown to follow. uses Nitro4D SoundFX, tube sound from Cubase
  21. If you subtract header degrees from 270, it remaps to 0-360 https://www.dropbox.com/s/58ea77tjhm7k4kz/doing_a_360.c4d?dl=0 sorry about the DB - run out of upload space edit - I just tried using range mapper with your numbers - it works and I can't reproduce your problem https://www.dropbox.com/s/oel9txq555r2c1i/rangemap_version.c4d?dl=0 maybe it's a radian thing - it's easy to get mixed up with conversions. XPresso uses radians, but when you use degrees in the GUI (or user data) it does the radian conversion for you. I prefer to stick to radians throughout - you can type pi or pi/2 in a GUI data field to get the correct value - pi/2 = 90 deg, pi = 180 deg, 2 * pi = 360 deg etc some calculations (eg wheel rotation) are easier using radians
  22. How about a house rule - all solutions must have an explanation. I recently posted an XPresso solution to someone's query, and the guy actually thanked me for including an explanation in the XPresso remarks. Explanations should be a matter of course. I know it's difficult to guess the poster's level of knowledge, and pitch an explanation accordingly, but you can cover all bases by aiming the info at beginner standard - there's folk reading this forum who only got C4D trial yesterday ! My particular blind spot is cloners and effectors. I've seen some amazing cloner stuff here, but haven't a clue how it works - no explanation. > All solutions must have an explanation < end of rant . . .
  23. I think this XP iteration does it - the planes use the nulls data. I renamed the objects to tell them apart. https://www.dropbox.com/s/jvzw1nfniz2ggre/transferred.c4d?dl=0 sorry about the dropbox - I've run out of cafe storage
×
×
  • Create New...