这是用户在 2025-7-18 17:11 为 https://insydium.notion.site/Question-02ed879ec41c4f67abf65fd409431cc0 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
免费获取 Notion
页面图标

Question

Question

The Question layer is used to set up conditions which, if passed, will trigger actions.

Question

The first step is to assign what kind of question will be asked using the options: If (the default), Else If or Else.

If

The starting question of any hierarchy must always use the If option.
If you want to set the particle color when it gets to a specific age (older than 90 frames, for example), you would use an If question of the particle’s age, along with a Set Color action as its child.
The question is asked every frame and the Set Color action is only triggered when the condition of the question is passed.
This particle age question is set to the default If option. The hierarchy translates to: ‘If the particle age is greater than 90 frames, then set the color to blue.’

Else If

Else If questions can only be used when following an If question.
You can think of it as a follow-up question, which is only asked if the answer to the preceding If question is ‘no’.
An Else If question can be added to the previous example to trigger more particle color changes at another specified particle age.
When each particle is less than 60 frames old, in this animation, the first If question is not passed. Therefore, the follow-up Else If question is asked, but this too fails to pass. As a result, the particle’s color doesn’t change. After frame 60, the first If question is still not passed. However, now the follow-up Else If question is passed and the particles are turned pink. After frame 90, the first If question is finally passed and the particles are turned blue.

Else

Else questions can only be used when following an If or Else If question.
This question is only asked when any preceding questions are answered ‘no’.
An Else question can be added to the previous example to create a final layer of particle color change.
There are now 3 color changes in this scene. Prior to frame 60, the first If question is asked and not passed. Therefore the following Else If question is asked, but this too is not passed. So the final Else condition is asked, which triggers the green Set Color action. After frame 60, the first If question is not passed, so the following Else If question is asked. This time the condition is passed and the pink Set Color action is triggered. After frame 90, the first If question is passed, so the blue Set Color action is triggered.
Note: The order of Question layers is very important.
In the above example, you may ask why the last color change in the viewport (blue) is first on the questions list.
To understand this you could consider an example that demonstrates bad logic.
Here, the question order has been switched, so the AGE > 2s is 1st and the AGE > 3s is 2nd. The problem here is that the lower age question comes first in the list. This means that if the answer is true for the 2nd question, it will always be true for the 1st question as well. As a result, as soon as the particles get to 60 frames old, the first question will pass and the second question will be ignored. When the particles get to 90 frames old, the first question will still pass and the second will continue to be ignored. The logic does not work with this question order and the 2nd question will never be asked.
Due to the bad logic of this question hierarchy, the 2nd condition is never asked and, in this animation, the particles remain pink after their first color change.

Operator

Operators can be used to layer up questions so that conditions of multiple data types must be met to trigger actions.
In the preceding examples, the questions have driven a color change based on one data type; particle age.
But what if you wanted to test for age AND radius?
To do that, you would add a new question as a child of the first and choose one of the Operator options.
These are: AND, AND NOT, OR and OR NOT.
The second question is a child of the first. Its Operator function is set to AND. Now both the Age AND the Radius question must pass for the action to be triggered. Note: The Set Color action is a child of the 2nd question.

AND / AND NOT

These operator modes require both questions to be passed for the action to be triggered.
The difference is demonstrated in the examples below.
Here, the Set Color action is only triggered when the particles are older than 45 frames AND have a radius greater than 22cm.
In this animation, the Set Color action is only triggered when the particles are older than 45 frames AND NOT having a radius greater than 22cm.

OR / OR NOT

These operators require one of the questions to be passed for the action to be triggered.
The difference is demonstrated in the examples below.
The Set Color action is triggered when the particles are older than 45 frames OR have a radius greater than 22cm.
The Set Color action is triggered when the particles are older than 45 frames OR NOT having a radius greater than 22cm.

Category

Set as Particle, by default, this is what you are questioning for the condition.
The above examples have all used the Particle category, which give options like Age, Color and Radius.
The alternatives are: Document and Math.
Most types share the same parameter options (such as Condition, Value and Check Once); these are explained at the bottom of this page.
Parameters relating to individual Data options are explained below.

Data

The Data option is the available data that can be used from the chosen Category.
Each Category has a different set of Data options available to it.

Document question type

The possible Data options for the Document Question type.

Frame

Use this option to trigger actions at a specified scene Frame number.
This setting opens parameters for Condition, Value and Check Once.

Camera Distance

The distance to the camera.
This setting opens a Camera field, where you can drop a scene camera, and the Condition, Value and Check Once parameters.
This scene uses a Document Category in Camera Distance data mode. When the particles are less than 300cm away from the camera, the Set Color action is triggered.

Camera FOV

This asks if a particle is within the specified camera’s FOV (Field of View).
This will also open up 3 additional parameters: Camera field, Widen FOV, which allows the degree searched to be widened, and the Check Once option.
When the particles enter the selected camera’s FOV, the question is passed and their color is set to blue.

Object Distance

This works like the Camera Distance mode, explained above.
The difference is, as well as the usual parameters, this includes an additional Mode menu with more options.

Mode

This has the following settings: Points - distance to the nearest vertex. Position - distance to the object’s world location. Polygon - distance to the nearest polygon. Volume - distance to the nearest polygon, including volume test, where <0 is inside the object.
Here the Object Distance data is set to Volume mode. This tests whether particles are inside the volume of the sphere and, if they are, their color is set to blue.

Time

The document scene time.
Whether this is in seconds or frames will depend upon your Cinema 4D unit preferences.
By default this is set to frames.
As well as Condition and Check Once, this has the Time parameter.

Math question type

The possible Data options for the Math Question type.

Value

A constant value, set in the UI (User Interface), which can be set from expressions or animation.
The Value is keyframed from 0 (zero) to 10 over the course of the scene. With the Condition set to Greater than the Value of 5, the particles turn blue when the keyframed Value exceeds 5.

Random

A random value generated from within the Min and Max values.
This can be made random for each particle, by enabling the Particle ID option.
Use the Time Variation setting to control whether the random number is constant or if it should change every frame.
With Time Variation set to none, the random number will remain the same throughout the scene.
In Document mode, the random number will change every frame, globally, for all particles.
In Particle mode the random number will change every frame, per particle.
With Time Variation set to None and with Particle ID active, all particles are given an individual random number of between -1 and 1. The Condition is set to Greater than 0 (zero). This means that only particles that have a random number of above 0 (zero) will have their color set blue, resulting in half of them remaining orange.

Spline

A value based on a spline curve setting, where the x axis is time, based on the particle or the document time.
Here the Data mode is set to Spline and the Time Variation to Document. This means the x axis of the curve represents the full scene time and the y axis, the value. Following the curve up from left to right, the y axis reaches a value of 0.5 at the halfway mark of the scene, exactly, which is 80 frames. This is when the question is passed and the particles change to blue.

Variable

This is a value taken from a user variable, or a variable that is defined within a script (if local to the question, e.g. from an earlier or parent script).
The variable name must be entered correctly in the Name field.
In this question hierarchy there is a Variable layer called ‘ScaleUp’. The question is set to the Math category using a Variable as the Data type. The variable name ‘ScaleUp’ has been entered into the Name field. The question is asking whether the value contained within the ScaleUp variable layer is greater than 0 (zero). If so, the question will pass and the Set Color action activated.

Wave

A sine-based wave, with the range -100 to 100, where the value varies based on the Frequency amount and the Document or Particle Time Variation option.
This mode is useful for creating oscillating effects, like regularly flashing particles.
The effects of the sine wave are clear here. When the wave value is above 80, the color is set to blue. The Else question sets it back to orange once the wave value dips below 80. In the Document Time Variation mode, the action is triggered globally.
This time, the Variation Mode is set to Particle. Here, the frequency of the wave is dependent upon the particle age. The result is the time of the blue color change is different for each particle, depending on when they were born.

Particle question type

The possible Data options for the Particle Question type.

Age

The particle’s age, in seconds.

Color

The particle’s color; a Vector setting of R, G, B or Brightness.
All particles are born with a radius of 15cm. The Set Radius action increases this radius to 60cm. However, the If Color question dictates that it is only applied to particles with a color brightness of above 0.9. Note: The weight of the Set Radius action is set to only 12%, which creates the scaling up effect.

Count

The total number of particles.

Fluid Density

The calculated fluid density around a particle.
Note: This data is only generated when using a fluid solver, such as nxFluid.
This If Fluid Density question hierarchy means that particles with a fluid density of less than 0.9 have their color set to pink.

Travelled

The total distance currently travelled by the particle.

Emitter

A true/false for if the particle’s emitter is (or is not) in the Emitter list shown.
Use this to isolate the affects of an action to specific emitters.
Here there are two emitters called Left (orange) and Right (blue). By default, the particles from both emitters are affected by the nxQuestion list.
With the addition of an AND Emitter question, now only particles from the right hand emitter are affected.

Field

The field (falloff) value for the particle.
This mode requires an active field to be present within the nxQuestion object Fields tab.
In this animation, contact with the Spherical field is enlarging the particles.

Flags

If any of the shown flags (Hit Object, Hit Particle, Changed Group, Stuck and Frozen) are enabled for the particle.
Here, with the Hit Object flag enabled, those particles hitting the Torus have their color changed to orange.

Group

The group the particle is in (0 - zero - means no group assigned, default).
In this scene, only particles from Particle Group 2 are affected by the action and have their Radius set to 8cm.

ID

The particle’s unique ID.
In this scene, the particle IDs have been made visible, via the xpEmitter Display tab options. The question is set to Particle ID with value set to 4. This means the Set Radius action only affects the particle with this ID.

Life

The life span of the particle.

Mass

The mass of the particle.

Neighbors

How many particles are within a Distance setting around the particle.
Here, with the Neighbors setting, only particles that have more than 2 (the Value setting) neighbors within the Distance value of 20cm, are set to orange.

Position

The world position of the particle per Vector: X, Y or Z.

Radius

The radius of the particles.

Rotation

The rotation of the particles, in the heading (H), pitch (P) or bank (B).

Speed

The particle’s speed.

UVW

The particle’s UVW components (picked from X, Y and Z).
To activate UVW data, the xpEmitter must be setup to emit from an object texture.
In addition, the UV Data must be checked in the Extended Data - General Data tab.
Animation to demonstrate the effect of the Data setting of UVW, with particles set to change color to orange should their UVW on the X axis be less than 0.5.
xpEmitter set up, with UV Emission Data enabled.

Velocity

The particle’s velocity components (picked from the Vector setting of X, Y and Z).

Vertex Weight

The particle’s assigned vertex weight, usually set on emission.
This data is not generated by default.
Setting this up requires the following steps.
1: The particles must be emitted from the points of a scene object that has a vertex weight tag; to do this, go to the emitter Object tab, and set the Emitter Shape to Object.
2: Drag the scene object into the Object link field
3: Drag the vertex map into the Selection link field.
4: Set Emit From to Points.
5: In the emitter Extended Data - General Data tab, activate Emission Vertex.
xpEmitter set up for the Vertex Weight setting.
Emission Vertex enabled in the Extended Data tab.
Now, vertex data is being generated per particle, this can be used in an nxQuestion setup.
In this scene, particles with a Vertex Weight of less than 0.5 are turned orange.

Condition

Less, Less-Equal, Equal, Not Equal, Greater-Equal and Greater are all conditions for how to use the data and compare it to a Value setting to give if the question is successful (true).
Within, Not Within can be used as some data may not be exact (floating point), this gives the option for a value to be within a range of values.

Value

The constant value set and measured against.

Time

The scene frame set and measured against.

Check Once

If, enabled, once the question is successful, it won't be checked again.
This animation shows Check Once disabled, so the question is repeatedly checked, repeatedly changing each particle’s color.
With Check Once enabled, in this final animation, the question is successful and is not checked again.
Copyright © 2024 INSYDIUM LTD. All Rights Reserved.