Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by jed

  1. I don't use coffee, but I think testing a value using time is not a good idea. The time value on a frame is a decimal, and you'd have to compare it to an exact value. Much better to use the integer 'frame' for comparison eg if frame == 8 can be evaluated correctly. If you just want an event to trigger every X frames, you can do it easily in xpresso using modulo (modulo counts up to a number, then resets to zero and counts again) looking at your code, I'm guessing you want to toggle luminance on/off at a certain frequency. Here's one way to do that using Python flasher.c4d
  2. There's an off-beat panel show on UK TV called QI, chaired by Stephen Fry (of Jeeves and Wooster, Wilde fame) that often features quirky physics demo's. This usually inspires yours truly to have a go at recreating said demo in C4D. Recently, Mr Fry announced 'did you know I could knock The Shard over using a feather ?' (The Shard is a 300m tower in London). He then produced a set of blocks of wood of geometrically increasing size, lined them up like dominoes and hit the smallest with a feather. The 1st block hit the 2nd which hit the 3rd etc until the last (very large) block went down. The block increment was 150%, and SF claimed you'd only need 24 to knock down The Shard. Here's my first attempt - uses a pendulum to simulate the feather QI_scene.c4d
  3. You can use a data node to find the position of a particular clone, then locate the 2nd cloner at that position. locate.c4d
  4. If you use radians, the angle a wheel radius R turns when moving distance D is angle = D / R XPresso uses radians Truck_c4dcafe2.c4d
  5. Thanks for explanation - I think I've got it. Google just took me to stackoverflow, where the answers tend to consist entirely of reserved words...
  6. @kalugin I noticed you used == for keys, I've read that it should be bitwise & - any thoughts on this ? 2 of my projects using kb input - ctrl, alt control flippers in this pinball machine (has sound) pinball.c4d use ctrl, alt to steer stickman on unicycle orangeman2.c4d
  7. jed

    Roll expression

    @BigAl3D Have you tried the base80 wheel ? You just make the wheel the same size as the vehicle wheel, and make the real wheel a child. You can also link rot P in XPresso. Works in any direction, as long as you move the parent. base80.c4d @HSrdelic that looks a lot like Roll-It
  8. For actual bumper car movement, you'd need motors and wheels (and possibly random steering). You can detect collision in XPresso, then reverse the motor (or steering direction etc). Just getting things to bounce and keep moving for ever with dynamics is quite difficult. Increasing bounce % to achieve this can make things go crazy. Spheres seem to bounce best, and you can keep things going to some degree by detecting collision, then changing some size parameter eg constraining outer wall moves in on collision. In this file I've got some hidden spheres with visible stuff constrained to their movement (and hidden collision wall). You still get objects 'dead in the water' ... bounce.c4d there's some custom initial velocity to get things moving edit - there's some bumper car type collision detection in this video (from about 30s)
  9. The plug in Roll It is good for rolling stuff. You put the sphere in a parent null, move the null and the sphere just rolls as if it were touching the ground. It can roll irregular objects, so has an auto radius setting, but for spheres, I've found manually setting the radius gives a more accurate result. http://eggtion.net/playground/cinema4d/roll-it-2017?lang=en BB8 Roll-It with landscape floor object edit - works in R20
  10. jed

    Shear strength to degrees

    Now I'm confused - there's no single answer to this problem because 100% strength gives different angles depending on the lengths Size.X and Size.Y , hence my XPresso. For a square object the lean angle is 26.565 deg.
  11. jed

    Shear strength to degrees

    @HSrdelic but you don't learn about inverse trig :-)
  12. jed

    Shear strength to degrees

    By eyeballing it, it seems 100% corresponds to the top moving 1/2 of the width, so I came up with this. I put a cylinder in for comparison - type the result into rot B to check the angle is correct. arctan.c4d arctan is 'angle whose tangent is'
  13. jed

    Volume Builder test

    @bezo was just guessing with voxels
  14. jed

    Volume Builder test

    Thanks Igor. Version 2 has different camera angles If anyone's interested, to get the cut out I started with a plane and an approximate 3 point spline. I put 2 nulls at the ends of the rod and used XPresso ray collision to get the hit positions on the plane, then used that data and point node to set the spline points more accurately (plus structure and some math tweaking). I swapped out the plane for a cube, made a sweep on the spline, and stuck it all in volumes. Volumes seems to give nice smooth booles. R20 scene rod.c4d
  15. I saw this interesting gizmo on YouTube, and thought I'd have a go at doing the cutout using R20 Volume Builder https://vimeo.com/288629613/708a352c47
  16. I'm not too sure what behavior you want, but you can use a condition node to switch 2 values into the Lower from port. Cafe bijlage2.c4d
  17. jed

    simple xpresso question

    You can just multiply frame by 2 degrees - needs to be converted to radians. I'm guessing you need more than this eg start/stop times ? bend.c4d
  18. jed

    Random Walk

    I sent some scenes - see message box.
  19. jed

    Random Walk

    @southpaw - the 'limit = 50' line should have been put higher up since it's not really in the modulo loop - should have been with the 6X vector list. I think I originally had the lines as if abs(...) > 50, but sometimes it's better to have a named value when troubleshooting (also quicker to change limit = 50 than to change 3 lines). So the speed of animation just consists of <find new vector and add it to position> every 2 frames. If the new vector takes the sphere outside the limit, it stays in the 'while loop' until a suitable vector is chosen. 'While loops' can be very problematic in C4D. If your code is bad and the program gets stuck in the 'while loop', you can't seem to halt or escape - you have to close C4D and thus lose any unsaved work. I usually develop code using Pycharm - a free python IDE. In Pycharm, it's easy to halt an infinite loop. You can write and test a function in Pycharm, then paste it into C4D. Although C4D python is different to regular python in that the code is repeated every frame (not just once), you can simulate this in Pycharm with a 'for loop' to some extent. Bear in mind that if you install Python 3.7 for use with Pycharm, there's some differences compared to C4D's v2.7 - mainly print syntax and integer division. I'm with you about MAXON Python SDK - it's like trying to understand Russian without a dictionary. I just look at other peoples code and steal bits that seem useful. The plugin cafe can be a place for this. Google search for python usually takes you to stack overflow. I've learned tons from that site, even though some of the replies seem to be written entirely in reserved words - a skill in itself. One rather obscure way I learn about programming in general is by randomly clicking through XKCD comics - many of the jokes are about coding eg this one . There's an Explain XKCD site where you can enter the comic number for in-depth explanations - eg code quality comic discussion. If you like, I could zip up half a dozen of my python scenes for you to look at. Not all are commented, but you might find bits you can steal. edit - re: syntax - are you aware that you can just drag stuff into python from the attrib manager eg camera focal length here def main(): cam = doc.SearchObject('Camera') cam[c4d.CAMERA_FOCUS] = 18
  20. jed

    Random Walk

    There's something about randomness and C4D that appeals to me - write some code, click play + see what happens. Different every time. This is quite a simple video using Python random - best viewed full screen on a large monitor, with speakers on. there's comments in the code random walk.c4d
  21. In this file I used a copy of the initial random effector to reverse the random can rotation, dynamics proximity to get the clone index, and a bit of python ... cans rotate.c4d it's as close as I could get - some ideas for you anyway
  22. Thanks guys. One problem I had was that, in close up, the balls hovered above the surfaces due to the minimum distance malarkey. I solved this by baking the dynamics then increasing the ball radius by 1 cm.
  23. I was watching this video on YouTube of a marble machine made out of cardboard, so I thought it would be fun to recreate it in C4D. ball_machine.c4d
  24. I had a go at making the perpetual motion desktop toy from Iron Man 2 - you can buy them from Swinging Sticks. Here's an explanation of my approach here's a render scene sticks.c4d might amuse someone
×
×
  • Create New...