1
0
This commit is contained in:
syui 2024-08-03 22:46:24 +09:00
parent 0b6ba63320
commit 49bc20b30c
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56

View File

@ -189,14 +189,19 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
Math.sqrt(x * x + y * y + z * z) Math.sqrt(x * x + y * y + z * z)
var model_color = 100; var model_color = 100;
if (g === 'sun'){ if (g === 'sun'){
const sphereGeometry = new SphereGeometry(1, 232, 232); const sphereGeometry = new SphereGeometry(1, 332, 332);
nodes.Object_2.geometry = sphereGeometry; nodes.Object_2.geometry = sphereGeometry;
model_scale = 0.3; model_scale = 1;
} else if (g === 'moon'){ } else if (g === 'moon'){
const sphereGeometry = new SphereGeometry(1, 132, 132); const sphereGeometry = new SphereGeometry(1, 132, 132);
nodes.Object_2.geometry = sphereGeometry; nodes.Object_2.geometry = sphereGeometry;
model_color = 1; model_color = 1;
model_scale = 0.1; model_scale = 0.1;
} else if (g === 'earth'){
const sphereGeometry = new SphereGeometry(1, 232, 232);
nodes.Object_2.geometry = sphereGeometry;
model_color = 0.5;
model_scale = 0.3;
} else if (g === 'asteroid') { } else if (g === 'asteroid') {
const sphereGeometry = new SphereGeometry(1, 32, 32); const sphereGeometry = new SphereGeometry(1, 32, 32);
nodes.Object_2.geometry = sphereGeometry; nodes.Object_2.geometry = sphereGeometry;
@ -235,7 +240,6 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
useFrame(({ clock }) => { useFrame(({ clock }) => {
// zoom in and out // zoom in and out
ref.current.rotation.z = clock.getElapsedTime() / 2 ref.current.rotation.z = clock.getElapsedTime() / 2
//ref.current.scale.setScalar(0.3)
ref.current.scale.setScalar(Math.sin(clock.getElapsedTime() / 10) + 1.2) ref.current.scale.setScalar(Math.sin(clock.getElapsedTime() / 10) + 1.2)
}) })
@ -286,7 +290,7 @@ export const ThreeFiberGalaxy = () => {
//maxAzimuthAngle={Math.PI / 4} //maxAzimuthAngle={Math.PI / 4}
//minPolarAngle={Math.PI / 1} //minPolarAngle={Math.PI / 1}
maxPolarAngle={Math.PI - Math.PI / 1} maxPolarAngle={Math.PI - Math.PI / 1}
minDistance={11} maxDistance={15} minDistance={20} maxDistance={30}
enableZoom={true} enablePan={false} enableRotate={true} enableZoom={true} enablePan={false} enableRotate={true}
zoomSpeed={0.5} zoomSpeed={0.5}
panSpeed={0.5} panSpeed={0.5}