-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vector3 param type #477
base: alpha
Are you sure you want to change the base?
vector3 param type #477
Conversation
@cale-bradbury what do ya think? Does this approach make sense to you? We'll have special slider components for each type (e.g. a color picker, XY field) but always with a "popout" option which exposes the underlying number nodes where users can assign inputs as always. |
if (valueType === 'vector3') { | ||
// Return an array of values for vector3 | ||
const childNodeIds = nodes[id].childNodeIds | ||
value = childNodeIds.map((childNodeId) => nodeValues[childNodeId]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting all child nodes and creating an array to be handed to the sketch. Is that how users will want it? We could also hand it back as an object with x
, y
and z
properties (or r
, g
, b
for colors...). Part of me thinks an array is simplest and the user can deal with it how they please.
@@ -39,6 +40,8 @@ export default class Solid { | |||
this.root.rotation.y += params.rotSpeedY * baseSpeed * deltaFrame | |||
this.root.rotation.z += params.rotSpeedZ * baseSpeed * deltaFrame | |||
|
|||
this.root.position.set(...params.position) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the array format works perfectly for three js, having it as object with x
, y
and z
properties would just be more work, but I can imagine other times it would be nicer to have it the other way around. However for most cases, including color, three.js plays nicely with plain array so maybe we stick with the simplest approach.
This introduces a new type of param to the core,
vector3
. It has achildNodeIds
property which points to three more param nodes with thenumber
value type. It feels like a nicer way to do it so we can still link inputs to these child nodes as if they were any other number node, rather than dealing with actual array values.At the last step of the engine, the array gets created from the three child nodes and passed as a param to the sketch. I think we can merge this sooner rather than later, in future PRs, I plan to:
vector2
,rgb
,hsl
types, each with their own special component (e.g. color picker)