@ferdinand I've played with your idea for a bit and then realized, that the point where the adj meets the ground is wrong, as it should be the point where a circle or f = opp with center in O meets the ground. Eventually I decided to just hack it a bit and change the position of the rotating object and the object inside to counter that move. Here's the result:
Posts made by SweepingMotion
-
RE: Changing axis rotation position
-
RE: Changing axis rotation position
@mogh @ferdinand
I'm building a python tag to handle these cards:
cards_script_v01.mp4
Works quite well when cards are flat. But I'd like to add some thickness. At the moment when crossing the vertical I move the top object to where the pivot should be and move the inside object in the opposite direction:
cards_script_v01-thickness.mp4
I was wondering though if there might be a better way of doing it.
The image in my original post was showing the situation - rotation around the central point at the base vs rotation around the corner of the base. Sorry if I didn't make myself clear.@ferdinand How would I construct this vector in c4d in python?
-
Changing axis rotation position
What I'm trying to do is a python tag that wobbles a cube inside a null - so in fact wobbles the null itself.
The rotation axis is centered on the cube's base. When it's at 0 degrees that's its axis rotation. However when it's below, the axis moves to one corner, and then the opposite happens for positive rotation.I would like to know how I can find out and offset that would allow me to rotate the black cube around the base center and then move it to the position it would have if it rotated around the corner. So basically the V vector on the drawing.
Unless there's a better way of changing the pivot point.
-
RE: Python field error
@m_adam said in Python field error:
A fix is coming in one of the next version of Cinema 4D, so that OutputBlockSize == InputBlockSize and therefor you will not need to add this "useless" values at the end to fullfill the outValues.
That's great news. I'll hold off till then.
-
RE: Need help with python field - infection
Thank you @ferdinand that is fantastic help.
I think I'm going to put it on ice till I learn how to do a c++ field. What you made it almost exactly what I want BUT, I don't want to set the growth seeds - places where the growth starts, but rather add them dynamically. Think a balloon that touches a needle and it starts tearing from there, because that's exactly what I want to do.
-
RE: Need help with python field - infection
Thanks. I'm writing a python field.
What I want to do is have vertex map grow from certain points, but dynamically so I don't have to use freeze which from what I gather you can only set once.
I played with the python field and it indeed goes over the points in chunks of 400. This is where the block came from. It's called that in the input field manual in the SDK.
I'll see if the neighbour function works. -
Need help with python field - infection
Hi I'm writing a field effector that will work like infection in xparticles and need some pointers.
The logic is:- Weights are added based on objects from an object list influencing a vertex unless the vertex is on an INFECTED or DEAD list
- If a vertex has weight of over 0 it's added to the INFECTED list.
- All vertices from the INFECTED list have their weights increased every frame.
- If a vertex weight exceeds some threshold it's added to the DEAD list - it cannot be influenced by the field anymore.
- Every infected vertex has a chance of infecting neighbouring vertices within a radius (unless they are already on the INFECTED or DEAD list)
My questions are:
- The most important one: does a way of doing it already exist. What I want to do is have balloons simulation that dynamically pop when encountering and object from a list.
- I understand that vertices are given in blocks. How would I efficiently iterate over all of them - is there an option to thread/multiprocess them? Does anyone know of any example code I can follow and learn?
- How do I get neighbours of a vertex when it's neighbours might be in a different block?
-
RE: Python field error
I must've been half asleep when writing this yesterday. I now realize I didn't explain myself too well.
Just to explain the problem a bit better:
The setup - plane primitive with a vertex map applied, python field added.
Now everything is great until the number of points on the plane exceeds 400 - this is where the error crops up. Seems like the number of points in input list is capped at 400... but not the output list. -
Python field error
When add the default python field and increase the number of subdivs I'm getting this error. What gives?
Traceback (most recent call last): File "<Python Field_0>", line 22, in Sample BaseException: The input list is not long enough (need 400)
Just to reiterate this happens with the default unedited python field.
-
RE: Can I make a hierarchy of nulls inside a Python Generator behave like on in OM?
@i_mazlov sorry I thought I deleted this post as I solved the issue.
Anyway to anyone who stumbles upon this question here's how I solved it:
for i,pt in enumerate(points_list[::-1]): off = c4d.Vector(distance * i,0,0 ) mg = pt.GetMg() mg.off = off print(rotation.x) rm = c4d.utils.HPBToMatrix(rotation) pt.SetMg(mg * rm)
So basically if the objects are inserted in the hierarchy and you start from the last one with the transformations this will work just like in the OM.
-
RE: Why won't my python generator update? R2024
@baca @ferdinand Thank you both.
It was the fact that the user data was not collected in the main function. Silly I didn't catch that.
It's working fine now. -
Why won't my python generator update? R2024
I'm using user data to change rotations in a python generator. But it doesn't seem to want to update when I play the timeline? Should I add anything special to the script?
from typing import Optional import c4d from c4d import utils doc: c4d.documents.BaseDocument # The document evaluating this python generator op: c4d.BaseObject # The python generator hh: Optional["PyCapsule"] # A HierarchyHelp object, only defined when main is executed distance = op[c4d.ID_USERDATA,1] offset = op[c4d.ID_USERDATA,2] rotation = op[c4d.ID_USERDATA,3] def main() -> c4d.BaseObject: # create hierarchy of nulls points = 100 points_list = [] for p in range(points): pt = c4d.BaseObject(c4d.Onull) pt.SetParameter(c4d.NULLOBJECT_DISPLAY,c4d.NULLOBJECT_DISPLAY_SPHERE,c4d.DESCFLAGS_SET_NONE) if p==0: points_list.append(pt) else: pt.InsertUnder(points_list[p-1]) points_list.append(pt) # adjust position and rotation for i,pt in enumerate(points_list[::-1]): off = c4d.Vector(distance * i,0,0 ) mg = pt.GetMg() mg.off = off print(rotation.x) rm = c4d.utils.HPBToMatrix(rotation) pt.SetMg(mg * rm) return points_list[0]
-
Can I make a hierarchy of nulls inside a Python Generator behave like on in OM?
I created a hierarchy inside a python generator, but I would like it to behave like one in OM - so if I rotate one null, all the ones below rotate with it. Is this possible?