Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by jed

  1. Here's 2 methods for XPresso controlled cyclic rotation. The modulo file is simpler, but the monoflop file has more control. Info in XPresso remarks. https://www.dropbox.com/s/czaambirmctacek/modulo.c4d?dl=1 https://www.dropbox.com/s/qwia7udr0mg83os/monoflop.c4d?dl=1
  2. jed

    Trouble calculating angle

    Can you explain a bit better what you would like the final scene to do. I think you have got your formula mixed up - sin(a) = opposite / hypotenuse a = asin( opposite / hypotenuse ) arc sin is 'the angle whose sin is'. 90 degrees doesn't come into it. edit : I think I've got what you mean - calculate the length and angle of the hypotenuse when the points move horizontal (the hypotenuse has to change length else the 2 points would move together). Try this https://www.dropbox.com/s/ylkw8n1eesssmyr/inversetrig.c4d?dl=1
  3. Interesting - the bounding box has a different definition of center in that objects inside the box don't contribute to the calculation. I initially thought the main topic with this problem would be 'how do you define center' - like mean, mode and median in stats eg if one object is at x = 25,000 is the center of the objects way off in that direction or more or less at world center ? Your python has given me a few ideas. As a relative python noob, I tend to see it as 2 flavors in Cinema - regular number crunching python and the C4D-specific variety with object IDs etc. I don't have a problem learning version #1 - lots of easy to understand tutorials on YouTube, Lynda, Udemy etc, but I have difficulty with version #2. There just seems to be the documentation - which I find a bit hard going. Any suggestions welcome.
  4. I think you're over-complicating this. My 1st answer - just adding the items in one big math node is easier to understand.
  5. That corrected file is interesting. Not sure why it still works when I rearrange the objects but leave the XPresso the same - in fact I'm not sure why it works at all.
  6. @teknow that mix solution would get a bit busy with 16 objects as in post #1. You can iterate the objects, and do the math in Python. https://www.dropbox.com/s/gotli0xq1q28lhj/centered2.c4d?dl=1 edit : actually doc, your successive mix node solution doesn't give the center. Lets say there's 3 items at 0, 10 and 20 cm. By your math (0 and 10) > 50% mix > 5 (5 and 20) > 50% mix > 12.5 but the correct answer is 10 my method - (0 + 10 + 20) / 3 = 10 see comparison here in a circle https://www.dropbox.com/s/f4lahgp5z3c9agi/centerwrong.c4d?dl=1 and in a line https://www.dropbox.com/s/y6v6mmumf0rvhoi/centerwrong2.c4d?dl=1
  7. I guess it depends how you define the center - equidistant, average etc. I used to use a simple method for pointing a target camera at the center of several dynamic cars - I just added the vector positions and divided by the number of cars to get the average position ie center. You can't divide a vector in C4D, so you have to multiply by the reciprocal ie 1 / number. See file. If your objects don't move, the axis tool (mesh - Axis Center) might do what you want. I find that tool a bit confusing, but I think you can center to children under a null. https://www.dropbox.com/s/xpzyp0nauqyc5oh/centered.c4d?dl=1
  8. I made a version with a manual switch - easier than detecting a slider change. Problem is you don't say what happens to the disconnected ports - your logic needs looking at. There's 2 Python nodes in this file - one sets the unknown ports to zero. Try swapping them out. Some ideas for you anyway. https://www.dropbox.com/s/4y4bic8c0e5cgic/zrotalpha.c4d?dl=1
  9. re Z axis - the pointing null uses its local Z rotation to find the direction to steer with respect to its parent truck, so cab Z must point in same direction of travel. You had a rangemapper doing the conversion, which I suspected was causing problems (as well as the wheels not being aligned with the suspension). re smoothing - by coincidence, smoothing is an interest to me ATM. I have an ongoing project about audio spectrum analyzers (usually incorrectly called graphic equalisers) and smoothing is needed to stop the display being too jerky - current WIP here. Also, when I have cars bouncing around, I like to smooth the camera. Some smoothing examples in the zip file. There's a demo of the XPresso preset Soft Target, which smooths out a pointing obect when the target moves, and works up to a point. I used the code idea to build my own version. Basically it subtracts the output from the input and adds 10% of the difference to the output every frame, so the output approaches the input smoothly. Can be used with data, but works well with a camera. I've included my XPresso and Python versions. Also in the zip, a Python WIP for smoothing music (for the analyzer). This works by making a list whose length is the number of frames you want to average over. Every frame, the music level is added to the end of the list and the 1st item removed, thus keeping the list the same length. Every frame, all items in the list are summed and divided by the number of samples to give the average. I'm still working on this concept. If you've never used Python, have a look at the scripts anyway - there's explanations (of sorts). The zip is 20MB because there's a wav file. https://www.dropbox.com/s/mjukwurgwx2q6vg/smoothdemos.zip?dl=1 edit : for smoothing just using XPresso, I guess you could have a bunch of memory nodes set to 1F, 2F etc, add them and divide for an average
  10. I'm not sure what the title means re interpolation, but I've tweaked the truck a bit. I rotated the cab axis so Z is forwards, and dispensed with the rangemapper for the pointing null. Also the wheels and suspension were a bit out so I aligned them. The suspension was set quite hard, so I softened it and used ride height to compensate. Also lowered custom center of trailer (was rolling on turns). Truck is on a zigzag path in this file to test the steering - seems OK. If you can expand what the title means, I'll have another look at it. https://www.dropbox.com/s/vz01mwm5p1bjibo/cafetruck.c4d?dl=0 edit : have updated the file on Dropbox - better wheel alignment
  11. I think the answer to the 'tabs show as red arrows' question is that the code was developed in a 3rd party editor that showed tabs in that style, then pasted into Cinema.
  12. I know - it was my attempt at humor, although I'd still like the red arrows tab answer. The only line I understood was if __name__=='__main__': main() Did you know that the guy who invented Python named it after Monty Python's Flying Circus ?
  13. How did you get the red tabs in Python ?
  14. Reverting is one thing, but with new builds you have to be careful. The 7th gen Intels do not play nice with Windows 7 - from Wiki 'Kaby Lake is the first Intel platform to lack official driver support for versions of Windows older than Windows 10'.
  15. The camshaft is jumping a bit. How are you driving the rotation ? I find time node (seconds) > math multiply > Rotation.H (radians) is smooth.
  16. Iteration is really useful for setting up large scenes when you only have a vague idea about dimensions. radii etc. Have a look at this video of 100 staggered pendulums. Working out the lengths + spacing to make a nice curve, connecting all the dynamics, hinges etc would have taken an age - especially if you had to keep trying new variations, but with iteration you can throw together a rough setup and then tweak it 'on the fly'. Scenefile needs a half decent pc to run (has slider for start angle). Might amuse you. https://www.dropbox.com/s/hrjp4arne76qxzp/pendulums.c4d?dl=1
  17. That's iterating 2 sets of 4 items - @degrotepeter wanted 1 output 'has there been any collision with items in the iteration list'.
  18. @Abyss I've a gut feeling there's an easier solution that I'm missing. I think the reason the original setup didn't work is mixing iteration with normal nodes. The linklist is outputting several objects one after the other, but the collision node is a 'static' test. It's like when you hang a result node on some iteration object - you don't see what you expect, you see the last object on the list. A brute force method would be to just have a big page of collision nodes eg this setup detects the sphere colliding with any cube - then scale it up. It's more or less what my Python list method does. I've only dabbled in XPresso Python nodes. There's an area of Python I've yet to learn, where the script manipulates C4D objects and methods by name/ID. I think some nested loops where you could test 'does any object on list #1 collide with any object on list #2' would solve this multiple collision problem.
  19. IIRC I setup the lists with all elements zero at F0, so timeline had to be F0 then F1 or more to make it operate - not necessarily running. The XPresso window calculates once per frame, but moving stuff around also recalculates even when the timeline is stopped. I thought the next question would be 'one blue cube can register collisions with 2 yellows - how to fix ?' After looking at the Wiki page on Conway game, I'll be interested to see where you're going with this.
  20. Try this - uses collision and counts how many outer cubes in the X have been intercepted. Not very elegant ie some repetition, but it seems to work. Timeline either needs to be running, or rewind to F0 then move to F1. https://www.dropbox.com/s/mutqrd5o99d6jy6/collide2.c4d?dl=1
  21. I think you're going to have to learn some coding. If I understand the game, you need to know how many objects are close to one central object. In this file I used distance as the trigger, and made a list with the same number of elements as the surrounding 'swarm'. Then I iterated through the objects writing a 1 for close (and 0 for not close) to the list. Adding the 0's and 1's in the list gives the number closer than the trigger distance. Not sure how this would scale up, but some ideas for you. I put a vibrate on the center object for testing. The script resets at F0, so F must be > 0. https://www.dropbox.com/s/4uc5bhu2j3hhvza/collide.c4d?dl=1
  22. jed

    Folding Door Rigging

    No probs - it's not every day I get to use arccos !
  23. jed

    Folding Door Rigging

    Here's my take on the problem using trig instead of joints. I'll let you sort the symmetry out. https://www.dropbox.com/s/x6nzuqe95f3etqw/door.c4d?dl=1 math for above
  24. jed

    Materials to indv objects

    Have you tried going thru the mats with object index? In this file it works with 32 mats + objects. https://www.dropbox.com/s/udb6w0lkzxq0y3p/mat_node.c4d?dl=0
×
×
  • Create New...

Copyright Core 4D © 2024 Powered by Invision Community