Here I'll explain how the blocks of my extension work in relation of the Three JS functions and methods! I would recommend taking a look at the Three JS documentation.
I'll be including tables with images of the blocks and some short descriptions.
Also tables, defining extra properties or the diferent types of concepts.
*scene can be seen as a group, the parent group where everything goes.
add camera [Perspective v] [myCamera] to [scene]:: #38c59b |
Adds a camera to a group. At [0,0,3] in world space.
By now, only Perspective Camera works.
new THREE.PerspectiveCamera()
|
set camera [Near v] of [myCamera] to (0.1):: #38c59b |
Sets a property of a camera to a value. Number. |
(get camera [Near v] of [myCamera]:: #38c59b) |
Returns a property of a camera. Number. |
set rendering camera to [myCamera]:: #38c59b |
Asign the camera that will be used to render the scene. |
clone object [myObject] as [myClone] & add to [scene]:: #38c567 |
Adds a copy of an already existing object to a group. Same geometry, material and transforms. |
set [Geometry v] of object [myObject] to [myGeometry]:: #38c567 |
Asign an existing geometry to the object. Crucial for rendering, to see something. |
(get [Geometry v] of object [myObject]:: #38c567) |
Return the contents of the selected property of the object. Stringified JSON. |
<is there an object [myObject]?:: #38c567> |
Check if the object (anytype) exists. |
remove object [myObject] from scene:: #38c567 |
Deletes the object (anytype) from scene. Does not delete the geometry nor material. |
set transform [Position v] of [myObject] to [\[0,0,0\]]:: motion |
Changes a transform of the object to a vector3. Position, Rotation, Scale or Facing direction. Rotation is done in YXZ order. |
(get [Position v] of [myObject]:: motion) |
Returns a vector3 of a transform of the object. |
<is there a geometry [myGeometry]:: list |
Checks if the geometry exists. |
remove geometry [myGeometry]:: list |
Removes the geometry properly.
geometry.dispose()
|
create spline [mySpline] from (generate cruve [CatmullRomCurve3] from points [\[0,3,0\] \[2.5,-1.5,0\] \[-2.5,-1.5,0\]]:: list), closed: [true]:: list |
Creates a spline geometry of a unique type (for now, CatmullRomCurve3). Use curve. |
create text geometry [myText] with text [Hello World!] in font [import v] size (1) depth (0.1) curvedSegments (6):: list |
Creates a text geometry that displays the given text in a imported font. |
(New Vector [0] [0]:: #3875c5) |
Returns a Vector2 as an Array. Can be used to set properties of some materials. [0,0] |
(New Vector [0] [0] [0]:: #3875c5) |
Returns a Vector3 as an Array. Usually to set transforms [0,0,0] |
(move [1] steps in vector [\[0,0,0\]] in direction [\[1,0,0\]]:: #3875c5) |
Like the move (10) steps block. Needs to be fed a Vector3 direction. Returns a new Vector3. |
(direction from [\[0,0,3\]] to [\[0,0,0\]]:: #3875c5) |
Returns the Vector3 of the direction. |
(New Color (#96f):: #3875c5) |
Returns an [object Object]. Don't mind it. Used to set colors of materials or the scene background. |
(New Fog (#96f) (0) (10):: #3875c5) |
Specify the color, near and far of the fog. Returns an [object Object]. Don't mind it. Used to set the scene fog. |
(New Texture ((costume1 v)::#96f) [Pixelate v] [Repeat v] repeat (1) (1):: #3875c5) |
Creates a texture from a costume. Returns an [object Object]. Don't mind it. Used to set the scene background, all material maps and more... |
(New Cube Texture X+((costume1 v)::#96f) X-((costume1 v)::#96f) Y+((costume2 v)::#96f) Y-((costume2 v)::#96f) Z+((costume1 v)::#96f) Z-((costume1 v)::#96f) [Pixelate v] [Repeat v] repeat (1) (1):: #3875c5) |
Creates a Cube Texture from a costume, to give each face of a 3D cube a specific texture. Same applications as Texture. |
(New Equirectangular Texture ((costume1 v)::#96f) [Pixelate v]:: #3875c5) |
Creates a texture from a 360 costume, like this. Same applications as Texture. |
(generate cruve [CatmullRomCurve3] from points [\[0,3,0\] \[2.5,-1.5,0\] \[-2.5,-1.5,0\]]:: list) |
Used to generate a curve that can be used to create the spline curve geometry. |
<mouse [left v] [Down v]?:: sensing |
Overlaying Three JD on top of scratch disables the mouse down block. I made this block to replace it. |
(get item (1) of [\["myObject", "myLight"\]]:: list) |
Helper block. Returns the item in the Array position (starting on 1). To get an axis from a vector or objects from a raycast. |
Raycast from [\[0,0,3\]] in direction [\[0,0,1\]]:: #3875c5 |
Sends a ray coming from [0,0,3] in direction [0,0,1], every object that the ray goes thru will be stored. For sensing things, grabbing objects?, collisions?... |
(get raycast [Intersected Object Names v]:: #3875c5) |
Get the above raycast results. You can read the number of objects, their names and their distances. (always ordered from closer-further) |
add [model v] as [myModel] to [scene]::#c53838 |
Adds the selected preloaded model to the group. It will be added as a group, so when transforming [myModel] all of the children (whole model) gets it. |
(get object [Animations v] of [myModel]::#c53838) |
Some models can come with an animation, get the names of these with this reporter. |
play animation [walk] of [myModel], (0) times::#c53838 |
If the model has animations, place the name here and make it play a certain number of times. 0 times = forever. |
set (Pause v) animation [walk] of [myModel]::#c53838 |
If the model is running an animation, pause it or unpause it. |
stop animation [walk] of [myModel]::#c53838 |
If the model is running an animation, stop it. |
reset composer::#c538a2 |
Cleans/Resets added passes. Passes are the effects. Passes are added to the composer. |
add bloom intensity:[1] smoothing:[0.5] threshold:[0.5] | blend: [SCREEN] opacity:[1]::#c538a2 |
Bloom. Take a look at these examples. |
add god rays object:[myObject] density:[1] decay:[0.95] weight:[0.4] exposition:[0.1] | resolution:[1] samples:[64] | blend: [SCREEN] opacity:[1]::#c538a2 |
God rays. Take a look at these examples. |
add dots scale:[1] angle:[0] | blend: [SCREEN] opacity:[1]::#c538a2 |
Comic-Dotted overlay. Take a look at these examples. |
add depth of field focusDistance:[3] focalLength:[0.001] bokehScale:[4] | height:[240] | blend: [NORMAL] opacity:[1]::#c538a2 |
Enables adding a focus point, blurs everything out of the focus range. Take a look at these examples. |
add custom shader [myShader] with GLSL fragm [] vert [] | blend: [NORMAL v] opacity:[1]::#c538a2 |
For advanced composer passes- A bit limited. The next uniforms are avialbe: Resolution and Time. More info here. |
Joints can be used to restric the movement of an object in relation to another.
create FIXED joint between [myObject] & [myObject2] | anchor A: [\[0,0,0\]] [\[0,0,0\]] B: [\[0,1,0\]] [\[0,0,0\]]::#444 |
Fixed Joint. |
create SPHERICAL joint between [myObject] & [myObject2] | anchor A: [\[0,0,0\]] B: [\[0,1,0\]]::#444 |
Spherical Joint. |
create REVOLUTE joint between [myObject] & [myObject2] | anchor A: [\[0,0,0\]] B: [\[1,0,0\]] | axis: [\[0,1,0\]]::#444 |
Revolute Joint. |
*I recommend setting the transform of the objects to the one you place here, else it will go crazy.
The first value for each A/B is for position, if there's a second its for rotation.