Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by jed

  1. Controlling stuff by disabling XPresso is not the best method IMHO, but you could either keyframe the enable checkbox in attrib manager, or make a second XPresso control window, drag your main XP tag in and use the enable port. In this snip the compare <= gives a 1 for upto F25 for enable, then a 0 to disable.It's a bit more flexible. I'd suggest stopping the follow inside your code - post your scene and I'll have a look. If it's a big scene (or has copyright models etc) strip it down to the relevant part.
  2. I thought that's what the poster meant, although in my little (theoretical) test the string length changed by about 5% when stretched, so if my assumptions were correct the string diameter would only change by 2% - would you even notice a 2% change ? A rubber band gets thinner when you stretch it . . . I 'bow' to your superior knowledge on the subject.
  3. I'm guessing that a string gets thinner when it is stretched on a bow, and the volume is constant. I think the vol of a string is the cross section X length ie volume = pi * R^2 * L so if the volume is constant, R is proportional to the square root of 1/L - so doesn't change much. Try pulling the center point on this 'string' spline - there's an exaggerated circle for comparison. It hardly varies. https://www.dropbox.com/s/disr7u4vjk82on6/bow.c4d?dl=1
  4. Probably easiest to make a separate control XPresso window where your switch drives the enable port for your main XPresso. https://www.dropbox.com/s/m95k4ithd5tv9f8/enablexp.c4d?dl=1
  5. I hate to say this graphos, but I've wasted your time here - that code is too advanced for me to understand, although in a way it illustrates the problems I have with Python. There's a ton of tutorials on YouTube and elsewhere that will teach Python from print('hello world') and up. That's how I am learning regular number-crunching Python. There doesn't seem to be anything explaining C4D-specific Python that starts at 'hello world' - it's either the MAXON manual or nothing, and the MAXON book might as well be in Russian. If I were to type any of the terms in your code into the MAXON website search box, the results would be meaningless to me. TBH I can't tell which are your vars and which are reserved words. It's the same at StackOverflow - you need to be an advanced coder to understand the answers to questions posted by noobs, which sort of defeats the purpose of a forum. As usual, there's an XKCD comic that sums it all up.
  6. @graphos could you give an example of your basecontainer method - sounds interesting.
  7. Same problem with frame dependent on or off. I've noticed a similar thing when I want to print to console for debugging - there has to be an output port connected to a result etc to get a print (although removing the Python output port lets me print). It's no big deal having an extra unwanted port - just puzzling. Maybe it's not a bug - it's a feature, as the saying goes.
  8. Does an XPresso Python node need a connected output port to function correctly? I have a flying helicopter WIP that started life as an XPresso Python node with user data slider inputs and position etc output ports. It worked OK, but I decided to have a go at putting everything in the code ie reading my slider data and writing position + rotation vectors to the helicopter - no ports at all. Trouble is, it kept locking up - and intermittently at that. I thought it was my code, but after a lot of tinkering (trial and error) I found that having a 'dummy' variable connected to a result node - see snip - more or less guaranteed a flying helicopter. I tried a fix I read somewhere about c4d.EventAdd(), to no avail. I also tried copy/paste into a Python tag, but got even weirder reults - when I stopped the timeline, my helicopter kept flying ! Any insights into this output node mystery appreciated. Here's the WIP file - it has a bit of smoothing on the variables to make the aircraft react less jerky to the controls. File's 11MB due to some textures. https://www.dropbox.com/s/muln5vt8o3j4t0j/helicopter7.zip?dl=1
  9. I could be being generous here, but I'm sure sometimes a noob is overwhelmed by the answer and feels a bit embarrassed to say 'can I have that in English'. I realise it's hard to guess the level of knowledge the enquirer has, but if the noob question is 'how do I make this cube look nice?' and the reply is 'use a matrix fracture with a Voroni object and turbulence noise in the reflectance alpha channel with PLA set to negative infinity with a spline deformer mapped to a random vector using Python', the noob will think 'maybe C4D isn't for me'. You see replies here that just say something like 'use a step effector', and I think if the guy knew what a step effector was and how to use it he wouldn't be asking. I've got to admit I'm guilty of both blinding people with science, and being ashamed to ask for a better explanation. Maybe ashamed is a bit strong, but you get my drift.
  10. jed

    RC helicopter

    Thanks for comments. The math is based on how I generated the movement - both spacial and H rotation - of the helicopter, by adding a small value every frame. By varying the amount added, an object can speed up or slow down smoothly. This is a topic that crops up here from time to time when discussing rotation. Generating a rotation angle with angle = time in secs * a constant is fine for constant speed, but changing the speed by varying the constant usually results in the object going backwards or just glitching. Getting the angle by angle = angle at last frame + delta allows for smooth speed change by varying the delta. You can do this in XPresso usually needs zeroing at F0 or in Python def main(): global x frame = doc.GetTime().GetFrame(doc.GetFps()) # get current frame if frame == 0: x = 0 else: x += speed # increment x by speed the XP and the Python are evaluated once per frame, although when presented with the concept of x = x + 1 most folk go WHAT ?
  11. jed

    RC helicopter

    I've been having a bit of fun today doing the math to fly a Lego helicopter I got from Google's Sketchup 3D Warehouse, so I thought I'd share the file. The file's 11MB because there's some tex for the background mountains. I made a short video to show how it works scene https://www.dropbox.com/s/tcnzx19uqtyucg9/helicopter.zip?dl=1 there's a bit of info in the XPresso remarks.
  12. Shameless plug for some of my pendulum stuff on Vimeo - Newton's Cradle, 100 pendulums, 8 pendulums and a 3-way jointed pendulum.
  13. Am I missing something here ? What's wrong with a sweep, a circle and a rectangle ? doesn't matter if the rectangle is closed or not - the base hides it.
  14. Was surprised to see this the other day - only kidding - I re-inked yesterday's XKCD strip. The original is here. For people who don't know what I'm on about, XKCD is a 3X weekly comic strip about computers, programming, physics and nerdy stuff in general. There's an 'explain xkcd' site for all the strips eg for the above here, where I often find hidden references in what I thought was a simple joke eg the above strip alludes to the Alan Turing film The Imitation Game (which I'd missed). It's quite hard to find a good comic font - I used VTC Letterer Pro for my re-inking. 2 of my XKCD favorites - GOTO, and Code Quality https://www.xkcd.com/
  15. I loaded the preset, but for some reason couldn't see the contents. I unpacked it, and it seems to be 2 compares - is #1 lower than both #2 and #3. I replicated that in this file and it seems OK https://www.dropbox.com/s/263gawpledqc81h/2compares.c4d?dl=1 BTW - I'm out of my depth with baseobject-type python - I just do the regular number crunching variety.
  16. A bit out of my comfort zone with base objects, but by trial and error I came up with this def main(): global x, y, z, position position = obj_in[c4d.ID_BASEOBJECT_REL_POSITION] x = position[0] y = position[1] z = position[2] seems like you can treat the position vector as a list and extract items. You might need ABS not REL. https://www.dropbox.com/s/1nmdpjwi9x3x87n/vector.c4d?dl=1 BTW did you post the wrong file ? post the original so I can have a look at the problem
  17. Since you are a bit new to rangemappers (and possibly XPresso), maybe I should point out how % works in C4D (you have probably sussed this out already, but might help someone else). If you have RM input and output ranges set to 0 - 100%, and input say 50% from a slider or other node, then hang a result node on the output it shows 0.5 not 50. This because XPresso treats % as a decimal 0 >> 1. It confuses some people the first time it happens - double checking your math etc. A similar thing with degrees - if both RM ranges are set to 0 - 360 deg, and you input 30 deg, a result node on the output shows 0.524 because XPresso uses radians (2 * pi radians = 360 deg, 1 rad about 57 deg). For these reasons, I prefer to just use decimals and radians for my XPresso stuff then I know exactly what's what. A lot of C4D users think they have to use the degree node to (unnecessarily) convert degs + rads back and forth when using XPresso for wheel rotation calculations etc. There's no need - when you use degrees (or %) in the GUI, XPresso just converts them anyway.
  18. Are you saying the rangemapper is calculating outside the range - have you got clamp checked ?
  19. jed

    Range Mapper

    I see why you used 2D now. In fact I'd never noticed that 2D vector option in user data - so I learned something today as well.
  20. Your file has a heap of stuff I don't seem to have. This is how I'd do random speed on a spline, using noise - it's smoother than random numbers that jump all over the place every frame. https://www.dropbox.com/s/gqtw4im42g0spk3/rndvarspeed.c4d?dl=1
  21. jed

    Range Mapper

    Not sure why you are using 2D, but here's a 1D file. I think you are getting invert and negate mixed up> Invert is reciprocal ie 'one over' 1/x. Negate means multiply by -1. There's also a reverse checkbox in rangemapper. Percent often confuses people - percent in the XPresso window is actually decimal 0-1 eg 35% is .35 . Same goes for angles - degrees in GUI, radians in XP window. I prefer to stick with the units used in the XP window, then I know where I'm at. Some 1D teeth https://www.dropbox.com/s/watezvyegz5go68/teeth.c4d?dl=1
  22. jed

    oscilloscope

    This is a project that came to being thanks to a free model from SketchUp. I've an interest in electronic traces on screens eg Lissajous curves, spirograph traces etc and needed an oscilloscope to display an audio sweep. Turbosquid wanted $100-200 for a really nice 'scope, but luckily I found a half decent one free on SketchUp that was usable with a few tweaks. The next problem was the math. The human ear is logarithmic ie works on powers of 2 (octaves on a piano is a doubling of frequency), so I wanted to use a log frequency sweep (linear just sounds wrong). I delved into exponential math and came up with this. The display and digital readout correspond quite well to the frequency heard. Screen is a movie used as a mat, font is Digital Readout Upright. 10MB file for screen https://www.dropbox.com/s/bfmfps9emp8dwtv/sweep.zip?dl=1 audio tone/sweep generator free from here just a bit of fun really
  23. I don't think I've seen it mentioned here before, but I found a source of free 3D models yesterday - SketchUp 3D Warehouse. Seems to be a place where hobbyists upload their stuff, and reading through the T & Cs it looks like you can use the models for any non-commercial use. Here's a free computer I found I got a couple of semi trailer rigs, and there's also some half-decent city scapes eg NYC here the sketchup files have skp extension, and you can just drop them into cinema, although I've found that if there's a choice of versions an older one (say 2014) works best. https://3dwarehouse.sketchup.com/index.html apologies if this is old news - it's new to me
  24. @SolarPH what I meant was - something like: I need to control a light so that switch A does this and slider B does that. Your simplified version is your solution to whatever the original task was. Trouble is, I can't work out what the original task was from your solution. I'm also not sure what C motion has to do with things. A simple bit of python in a node can often be a solution to a complex truth table type xpresso problem. Not number crunching, just something like if A > B and C < D: output = blah elif A == B and D > C: output = blah blah else: output = fall back default if you get my drift
×
×
  • Create New...

Copyright Core 4D © 2024 Powered by Invision Community