forked from markNZed/processism-react-three
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneThree.js
More file actions
81 lines (64 loc) · 2.74 KB
/
Copy pathSceneThree.js
File metadata and controls
81 lines (64 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import React, { useEffect } from 'react';
import Scene from './Scene';
import { Camera, DynamicDoubleArrow, EmergentEntity, TargetText, EmergentEntityNoBoundary, EntityScopes } from '../animationComponents';
import * as THREE from 'three';
import { AnimationController } from '../AnimationController'; // Adjust import path as necessary
import useStore from '../useStore'; // Adjust import path as necessary
import { Environment, OrbitControls } from '@react-three/drei';
import { Physics, useRapier } from '@react-three/rapier';
import { Perf } from 'r3f-perf'
/****************************
Scene Description:
Demonstrate the concepts of bottom-up causation, top-down causation, emergent entities
The scene will be 2D viewed from above
In SceneOne there is an abstract concept of an Emergent Entity that is represented by a Circle.
In this scene we will not use an abstract circle to show the boundary of the entity.
The boundary of an Emergent Entity be formed by many small spheres.
Having the emergent entity with a fluid boundary is not obvious. It could use a soft body physics simulation.
Instead of top-down: outside-in
Instead of bottom-up: inside-out
****************************/
function SceneThree() {
// Delay, animationComponent id, animationState
const animationSequence = [
//[0, 'emergent1', { variant: "default" }],
];
const cameraInitialState = {
position: [0, 0, 35],
zoom: 35,
left: window.innerWidth / -2,
right: window.innerWidth / 2,
top: window.innerHeight / 2,
bottom: window.innerHeight / -2,
near: 0.1,
far: 100
};
//timestep defaults to 1 / 60 timeStep={"vary"}
// Physics allowSleep={true} ?
// Physics is paused so we can manually control the step from EntityScopes
// numSolverIterations={2} numAdditionalFrictionIterations={2} erp={0.5} allowedLinearError={0.01}
// numSolverIterations={2} numAdditionalFrictionIterations={2}
return (
<>
<AnimationController animations={animationSequence} useStore={useStore}>
<Physics timeStep={"vary"} gravity={[0, 0, 0]} paused={true} debug={false} >
<Perf />
<Scene>
<EntityScopes
id="EntityScopes1"
//radius={emergentEntityRadius}
color="blue"
/>
</Scene>
</Physics>
</AnimationController>
<Camera
id={"camera"}
initialState={cameraInitialState}
/>
<Environment preset="sunset" />
<OrbitControls enablePan={true} />
</>
);
}
export default SceneThree;