Skip to content
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

some time its getting fallingdown and Stuck from map how to respawn the model lot of bug here. #28

Open
DevaPandiyan opened this issue Jan 7, 2024 · 17 comments

Comments

@DevaPandiyan
Copy link

DevaPandiyan commented Jan 7, 2024

`

import { Canvas, useFrame } from '@react-three/fiber'
import { Environment, KeyboardControls, OrbitControls } from "@react-three/drei"
import { Perf } from 'r3f-perf';
import './App.css'
import Light from './Components/Light'
import { Map } from './Components/Map'
import { Map2 } from './Components/Map2'
import { Map4 } from './Components/Map4'
import { Map3 } from './Components/Map3'
// import { Map } from './Components/Map'
import { Physics, RigidBody } from '@react-three/rapier'
import { Suspense, useEffect, useRef } from 'react';
import { AnimaCharacterModel } from './Components/AnimaCharacterModel';
import { Avatar } from './Components/Avatar';
import Ecctrl, { EcctrlAnimation, EcctrlJoystick } from 'ecctrl';
import { useConfigurator } from './contexts/Configurator';

function App() {

const { loading, setLoading } = useConfigurator();
const keyboardMap = [
{ name: 'forward', keys: ['ArrowUp', 'KeyW'] },
{ name: 'backward', keys: ['ArrowDown', 'KeyS'] },
{ name: 'leftward', keys: ['ArrowLeft', 'KeyA'] },
{ name: 'rightward', keys: ['ArrowRight', 'KeyD'] },
{ name: 'jump', keys: ['Space'] },
{ name: 'run', keys: ['Shift'] },
{ name: 'action1', keys: ['1'] },
{ name: 'action2', keys: ['2'] },
{ name: 'action3', keys: ['3'] },
{ name: 'action4', keys: ['KeyF'] }
]

const characterURL = './AnimatedWoman.glb';

const animationSet = {
idle: 'CharacterArmature|Idle',
walk: 'CharacterArmature|Walk',
run: 'CharacterArmature|Run',
jump: 'CharacterArmature|Idle',
jumpIdle: 'CharacterArmature|Idle',
jumpLand: 'CharacterArmature|Idle',
fall: 'CharacterArmature|Idle', // This is for falling from high sky
action1: 'CharacterArmature|Wave',
action2: 'CharacterArmature|Death',
action3: 'CharacterArmature|HitRecieve',
action4: 'CharacterArmature|Punch_Left'

}

return (
<>


{/* */}


<Physics timeStep={"vary"} >

        <Suspense fallback={null}>
          {loading === true && (
            <Ecctrl animated position={[0, 10, 0]} >

              <EcctrlAnimation characterURL={characterURL}
                animationSet={animationSet}>
                <Avatar />

              </EcctrlAnimation>

            </Ecctrl>
          )}
        </Suspense>


      </KeyboardControls>
      <RigidBody type="fixed" name="ground">
        <mesh position-y={-5.3} receiveShadow>
          <boxGeometry args={[50, 0.5, 50]} />
          <meshStandardMaterial color="mediumpurple" />
        </mesh>
      </RigidBody>
      {/* <Map4 /> */}
      {/* <Map2 /> */}
      <Map4 />




    </Physics>

    <OrbitControls />

  </Canvas>
</>

)
}

export default App

`

new.onss.mov

Map4 here
`import React, { useEffect, useRef } from 'react'
import { useGLTF } from '@react-three/drei'
import { useConfigurator } from '../contexts/Configurator';
import { GLTFLoader } from 'three-stdlib';
import { RigidBody } from '@react-three/rapier';

export function Map4(props) {
const { nodes, materials } = useGLTF('/metafactory_booth.glb')

const loader = new GLTFLoader();
const { loading, setLoading } = useConfigurator();

useEffect(()=>{
loader.load(
"/metafactory_booth.glb",
( gltf ) => {

      setLoading(true)
     
  },
  ( xhr ) => {
   
      // called while loading is progressing
      console.log( `${( xhr.loaded / xhr.total * 100 )}% loaded` );
  },
  ( error ) => {

      // called when loading has errors
      console.error( 'An error happened', error );
  },
  );

});

return (

<group {...props} dispose={null} position={[0,-3,0]}>
<group name="Clothes_rack_8" position={[0, 1.827, 0]} rotation={[-Math.PI / 2, 0, 0]} scale={0.024}>
<group name="Object_6_7" position={[-23.032, 260.432, -5.813]} rotation={[0, 0, -3.133]} scale={0.604}>





<group name="B1_Teal_9" position={[3.29, 7.184, 5.46]} rotation={[0, -1.54, 0]} scale={[0.822, 0.822, 0.009]}>





<group name="Sketchfab_model_14" position={[16.228, 0, 0]} rotation={[-Math.PI / 2, 0, 0]} scale={0.526}>
<mesh name="Object_27" geometry={nodes.Object_27.geometry} material={materials['Materiale.002']} position={[-30.794, -0.149, 2.86]} scale={[0.698, 0.928, 0.695]} />
<mesh name="Object_29" geometry={nodes.Object_29.geometry} material={materials.aiStandard2SG} position={[3.799, 0, 0]} scale={[1.735, 1, 1]} />

<group name="B1_Teal001_15" position={[-0.666, 2.041, 4.385]} rotation={[-Math.PI, 0, -Math.PI]} scale={[0.211, 0.211, 0.002]}>





<group name="Cube001_26" position={[-2.906, 1.746, -3.9]} rotation={[0, Math.PI / 2, 0]} scale={[0.445, 0.325, 0.877]}>

<mesh name="Object_57" geometry={nodes.Object_57.geometry} material={materials['Materiale.004']} />

<group name="Cube002_30" position={[-2.91, 1.746, -5.816]} rotation={[0, Math.PI / 2, 0]} scale={[0.445, 0.325, 0.877]}>

<mesh name="Object_60" geometry={nodes.Object_60.geometry} material={materials['Materiale.004']} />

<group name="Cube003_31" position={[1.839, 1.746, -5.816]} rotation={[0, Math.PI / 2, 0]} scale={[0.445, 0.325, 0.877]}>

<mesh name="Object_63" geometry={nodes.Object_63.geometry} material={materials['Materiale.004']} />

{/* <mesh name="Object_7_1" geometry={nodes.Object_7_1.geometry} material={materials.Materiale} rotation={[-Math.PI / 2, 0, 0]} /> */}
<mesh name="Object_11" geometry={nodes.Object_11.geometry} material={materials.boothsheet_branding} rotation={[-Math.PI / 2, 0, 0]} />
<mesh name="Object_23" geometry={nodes.Object_23.geometry} material={materials['tshirt.003']} position={[-2.483, 2.37, -4.051]} scale={0.782} />
<mesh name="Object_36" geometry={nodes.Object_36.geometry} material={materials.material} position={[2.273, 2.496, -5.983]} rotation={[0.004, -0.32, 0.002]} scale={1.22} />
<mesh name="Object_38" geometry={nodes.Object_38.geometry} material={materials.hoodie} position={[-3.305, 2.479, -5.865]} rotation={[0, 0.096, 0]} />
<mesh name="Object_40" geometry={nodes.Object_40.geometry} material={materials.longsleeve} position={[1.427, 2.204, -5.966]} rotation={[0, -0.014, 0]} scale={1.206} />
<mesh name="Object_42" geometry={nodes.Object_42.geometry} material={materials.Atlas1} position={[1.918, 2.477, 6.525]} rotation={[Math.PI / 2, 0, 0]} scale={0.01} />
<mesh name="Object_44" geometry={nodes.Object_44.geometry} material={materials.material_0} position={[-1.327, 2.54, 4.819]} rotation={[Math.PI / 2, 0, 0]} scale={0.012} />
<mesh name="Object_46" geometry={nodes.Object_46.geometry} material={materials.Jacket} position={[-0.723, 3.126, 4.932]} rotation={[Math.PI / 2, 0, 0]} scale={0.012} />
<mesh name="Object_48" geometry={nodes.Object_48.geometry} material={materials.Materiale} position={[-0.685, 3.372, 4.791]} rotation={[Math.PI / 2, 0, 0]} scale={0.012} />
<mesh name="Object_50" geometry={nodes.Object_50.geometry} material={materials.tanktop} position={[-3.366, 2.367, -4.047]} rotation={[-Math.PI, -0.015, -Math.PI]} />
<mesh name="Object_52" geometry={nodes.Object_52.geometry} material={materials.sneakers} position={[-2.303, 2.065, -5.932]} rotation={[-Math.PI, 0.515, -Math.PI]} />
<mesh name="Object_54" geometry={nodes.Object_54.geometry} material={materials.Material} position={[2.28, 2.31, -5.987]} rotation={[0, 1.54, 0]} />
<mesh name="Object_65" geometry={nodes.Object_65.geometry} material={materials['Materiale.003']} position={[-2.9, 1.599, -3.896]} scale={[0.957, 0.006, 0.529]} />
<mesh name="Object_67" geometry={nodes.Object_67.geometry} material={materials['Materiale.003']} position={[-2.9, 1.599, -5.808]} scale={[0.957, 0.006, 0.529]} />
<mesh name="Object_69" geometry={nodes.Object_69.geometry} material={materials['Materiale.003']} position={[1.836, 1.599, -5.808]} scale={[0.957, 0.006, 0.529]} />
<mesh name="Object_71" geometry={nodes.Object_71.geometry} material={materials['Materiale.003']} position={[-0.672, 1.599, 4.86]} scale={[2.546, 0.006, 0.529]} />


)
}

useGLTF.preload('/metafactory_booth.glb')`

@DevaPandiyan DevaPandiyan changed the title some time its getting falling down from map how to respawn the model lot of bug here. some time its getting fallingdown and Stuck from map how to respawn the model lot of bug here. Jan 7, 2024
@ErdongChen-Andrew
Copy link
Member

Is your map4 wrapped inside < RigidBody > ?

@DevaPandiyan
Copy link
Author

yes

@ErdongChen-Andrew
Copy link
Member

It seems alright to me. Does it work properly when using just the ground?

@DevaPandiyan
Copy link
Author

DevaPandiyan commented Jan 8, 2024

It seems alright to me. Does it work properly when using just the ground?

yes ground work fine buy get and tried from free map models cant working properly its falling out of the model before loading map or once map is loaded confirmed after get character loading it not working

@DevaPandiyan
Copy link
Author

DevaPandiyan commented Jan 8, 2024

It seems alright to me. Does it work properly when using just the ground?

Only in groundworks fine, Additionally add map its not working again

https://ckk2kc-5173.csb.app/

`import { Canvas, useFrame } from "@react-three/fiber";
import {
Environment,
KeyboardControls,
OrbitControls,
} from "@react-three/drei";
import { Perf } from "r3f-perf";
import "./App.css";
import Light from "./Components/Light";
import { Map } from "./Components/Map";
import { Map2 } from "./Components/Map2";
import { Map4 } from "./Components/Map4";
import { Map3 } from "./Components/Map3";
// import { Map } from './Components/Map'
import { Physics, RigidBody } from "@react-three/rapier";

import { useConfigurator } from "./contexts/Configurator";
import { Experience } from "./Components/Experience";
import Ecctrl, { EcctrlAnimation, EcctrlJoystick } from "ecctrl";
import { Suspense } from "react";
import { Avatar } from "./Components/Avatar";
import { Playground } from "./Components/Playground";
import { Map5 } from "./Components/Map5";

function App() {
const { loading, setLoading } = useConfigurator();
const keyboardMap = [
{ name: "forward", keys: ["ArrowUp", "KeyW"] },
{ name: "backward", keys: ["ArrowDown", "KeyS"] },
{ name: "leftward", keys: ["ArrowLeft", "KeyA"] },
{ name: "rightward", keys: ["ArrowRight", "KeyD"] },
{ name: "jump", keys: ["Space"] },
{ name: "run", keys: ["Shift"] },
{ name: "action1", keys: ["1"] },
{ name: "action2", keys: ["2"] },
{ name: "action3", keys: ["3"] },
{ name: "action4", keys: ["KeyF"] },
];

const characterURL = "./AnimatedWoman.glb";

const animationSet = {
idle: "CharacterArmature|Idle",
walk: "CharacterArmature|Walk",
run: "CharacterArmature|Run",
jump: "CharacterArmature|Idle",
jumpIdle: "CharacterArmature|Idle",
jumpLand: "CharacterArmature|Idle",
fall: "CharacterArmature|Idle", // This is for falling from high sky
action1: "CharacterArmature|Wave",
action2: "CharacterArmature|Death",
action3: "CharacterArmature|HitRecieve",
action4: "CharacterArmature|Punch_Left",
};

return (
<>


{/* */}

    <Physics timeStep={"vary"}>
      <KeyboardControls map={keyboardMap}>
        <RigidBody type="fixed" colliders="trimesh">
          <mesh position-y={-3.3} receiveShadow>
            <boxGeometry args={[50, 0.5, 50]} />
            <meshStandardMaterial color="mediumpurple" />
          </mesh>
        </RigidBody>
        {loading === true && (
          <Experience
            characterURL={characterURL}
            animationSet={animationSet}
          />
        )}
      </KeyboardControls>
      <Map4 />
      {/* <Map2 /> */}
      {/* <Map /> */}
    </Physics>

    <OrbitControls />
  </Canvas>
</>

);
}

export default App;
`

@ErdongChen-Andrew
Copy link
Member

Could you set up a simple CodeSandbox? If the ground works there, the issue is likely related to the map setup.

@DevaPandiyan
Copy link
Author

Could you set up a simple CodeSandbox? If the ground works there, the issue is likely related to the map setup.

my sandbox account is now free not access to general edit. This is My Mail id devapandiyan19@gmail.com
Pls sent it your mail ID ill request to you edit access it...

@ErdongChen-Andrew
Copy link
Member

I think you can just creat a public CodeSandbox. I can fork it and make edits, similar to the one I created: https://codesandbox.io/p/sandbox/ecctrl-with-animations-nr4493

@DevaPandiyan
Copy link
Author

I think you can just creat a public CodeSandbox. I can fork it and make edits, similar to the one I created: https://codesandbox.io/p/sandbox/ecctrl-with-animations-nr4493

you can try with another map like(above 15 MB to 20 MB) Maps using it some devices it can falling down. in case i loaded the map first after loaded the character im facing same issues

@DevaPandiyan
Copy link
Author

DevaPandiyan commented Jan 9, 2024

icant share sandbox link because general public share isn't free.
i can share the zip file. can you make it public sandbox link

here is it https://drive.google.com/file/d/1TtNuybcncKjePDuXvlijaVS54UcI7r_2/view?usp=sharing

pls check it bro

@ErdongChen-Andrew
Copy link
Member

How come? I'm using the same free account, and you can make edits on it.
If you have a large map, try loading ecctrl once the map is ready

@DevaPandiyan
Copy link
Author

DevaPandiyan commented Jan 10, 2024

**>
{loading === true && (

      <Experience
        characterURL={characterURL}
        animationSet={animationSet}
      />
    )} 

**

i m already did it. not work and same issue, 15 Mb map is very below low configuration ecctrl not work perfectly. incase it may be by my mistake, and I shared the whole file in drive pls check the file in my drive. Or atleast give your mail id i request to you in code sandbox

@ErdongChen-Andrew
Copy link
Member

2024-01-10.15.04.16.mov

I tested your map, and it worked perfectly on my end.

@DevaPandiyan
Copy link
Author

DevaPandiyan commented Jan 11, 2024

Wow Amazing . what have you done can you share code . it was help me a lot just show me the code.
i have too show the same scenario but the problem is some device make it network related. like once the map loaded after i do it character loading here i face real problem is born. then its not getting perfect. thats why because you show the code i can relate it what is happening what is what pls share and Show me.

same.as.you.mov

and Then

change.the.new.code.mov

real problems

problem.mov
cant.move.animation.mov

@ErdongChen-Andrew
Copy link
Member

I just used the same code as yours without including the loading process. Unfortunately, I am not able to use that loading method due to too many errors.

@DevaPandiyan
Copy link
Author

DevaPandiyan commented Jan 11, 2024

I just used the same code as yours without including the loading process. Unfortunately, I am not able to use that loading method due to too many errors.

Pls give your Or Demo mail iD request to edit code sandbox .. pls
pls Or check it the new file
https://drive.google.com/file/d/1pNr8vwST013WXpY_ZwKtV3pioZbkTj3i/view?usp=sharing

@campbellgoe
Copy link

Isn't there some way to load the world before loading the falling character?

I'm currently experiencing issues when I load a larger map of models (some instanced). I still fall through the floor it seems because the map is still loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants