fix
This commit is contained in:
@ -17,7 +17,7 @@ interface ModelProps {
|
||||
scale?: number
|
||||
}
|
||||
|
||||
const VRMModel: React.FC<ModelProps> = ({ url = "./models/ai.vrm", url_anim="./models/default.vrma", position = [0, 0, 0], scale = 1, rotation = [0, 0, 0] }) => {
|
||||
const VRMModel: React.FC<ModelProps> = ({ url = "./models/ai.vrm", url_anim="./models/default.vrma", position = [0, 0, 0], scale = 1, rotation = [0, 1.5, 0] }) => {
|
||||
|
||||
const [vrm, setVrm] = useState<VRM | null>(null);
|
||||
const mixerRef = useRef<THREE.AnimationMixer | null>(null);
|
||||
@ -31,7 +31,7 @@ const VRMModel: React.FC<ModelProps> = ({ url = "./models/ai.vrm", url_anim="./m
|
||||
VRMUtils.removeUnnecessaryJoints(vrmModel.scene);
|
||||
setVrm(vrmModel);
|
||||
if (vrmModel) {
|
||||
vrmModel.scene.rotation.set(0,1.5,0);
|
||||
vrmModel.scene.rotation.set(...rotation);
|
||||
vrmModel.scene.position.set(...position);
|
||||
vrmModel.scene.scale.setScalar(scale);
|
||||
}
|
||||
@ -70,8 +70,9 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
var g = searchParams.get('g') ?? 'galaxy';
|
||||
var model_galaxy = "./models/galaxy.glb"
|
||||
var model_custom = "./models/ai.vrm"
|
||||
var model_scale = 0.01;
|
||||
var position_custom = [-0.3, -0.7, -0.2] as [number, number, number];
|
||||
var position_custom = [-0.2, -0.8, -0.3] as [number, number, number];
|
||||
var sphereGeometry = new SphereGeometry(1, 332, 332);
|
||||
var anim_custom = "./models/emote.vrma";
|
||||
const { nodes } = useGLTF(model_galaxy) as GLTFResult
|
||||
@ -89,6 +90,7 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
|
||||
model_scale = 0.01;
|
||||
position_custom = [-0.5,-1,0];
|
||||
anim_custom = "./models/fly.vrma";
|
||||
model_custom = "./models/ai_default.vrm";
|
||||
} else if (g === 'earth'){
|
||||
sphereGeometry = new SphereGeometry(1, 232, 232);
|
||||
nodes.Object_2.geometry = sphereGeometry;
|
||||
@ -96,6 +98,7 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
|
||||
model_scale = 0.3;
|
||||
position_custom = [-1,-1,0];
|
||||
anim_custom = "./models/fly.vrma";
|
||||
model_custom = "./models/ai_default.vrm";
|
||||
} else if (g === 'neutron') {
|
||||
model_color = 1;
|
||||
}
|
||||
@ -138,11 +141,11 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
|
||||
|
||||
return (
|
||||
<group {...props} dispose={null} ref={ref}>
|
||||
<VRMModel url="./models/ai.vrm" url_anim={anim_custom} position={position_custom} scale={1}/>
|
||||
<VRMModel url={model_custom} url_anim={anim_custom} position={position_custom} scale={1}/>
|
||||
<pointLight
|
||||
position={[0, 0, 0]}
|
||||
ref={galaxyCenterLightRef}
|
||||
intensity={0.1}
|
||||
intensity={0.2}
|
||||
/>
|
||||
<Points scale={model_scale} positions={positions} colors={colors} rotation={[1.5,0,0]}>
|
||||
<pointsMaterial
|
||||
|
Reference in New Issue
Block a user