Issue exporting to web , Nav Mesh and Camera Navigation not working

Hello ,

So , i tried importing Needle Engine exporter into my previous project in unity
2022.3.20f1

building the project was successful and i was able to log in the server and see my scene , but with Camera Issue …
in my unity project i have a simple FPS controller camera parented to a player …
but in the web build this did not work and i had a camera spectator view far from my scene and was not possible to control it …

also my camera was not colliding with the ground and fall of the ground mesh …

i would appreciate some guidance.

thank you in advance .

Hi Mahmoud Ismail,

For the issues you’re facing with exporting to the web and camera navigation in your Unity project using Needle Engine, here are some steps to troubleshoot:

  1. Camera Setup: Ensure your FPS controller camera is properly configured for the web environment. You might need to add the Camera component from Needle Engine to your camera object as follows:

    import { Camera } from "@needle-tools/engine";
    
    const cameraGameObject = /* your camera game object */;
    const cameraComponent = addNewComponent(cameraGameObject, Camera);
    
  2. Camera Collision: To ensure your camera collides with the ground, you should add a Collider component to both the camera and the ground. Use BoxCollider, SphereCollider, or any appropriate collider:

    import { BoxCollider } from "@needle-tools/engine";
    
    const colliderGameObject = /* your ground game object */;
    const colliderComponent = addNewComponent(colliderGameObject, BoxCollider);
    
  3. Camera Controls: If the camera is not controllable, ensure you add appropriate controls. Use OrbitControls or similar components to manage camera movement. Example:

    import { OrbitControls } from "@needle-tools/engine";
    
    const orbitControls = addNewComponent(cameraGameObject, OrbitControls);
    
  4. Testing in Browser: Log any configuration errors in the console when testing in the browser to check if all assets are loaded correctly and there are no runtime errors.

  5. Documentation References: To refer to Navmesh and camera components, review these links:

Make sure your dependencies and components are correctly set up and try the above suggestions. If issues persist, checking the console for errors during runtime can greatly help in pinpointing the problem.

Feel free to ask further questions for clarification or more specific help!

1 replies left - Get a PRO license for more AI replies.
thread_Kn0KsnDVgOhHK0qV3RAT9Gqp
Reply to this message to continue the conversation

I was able to get the camera not to fall of the ground by updating the script with the suggestion mentioned , how ever still my control doesn’t work for the FPS controller which is a simple mouse look script that i have attached to the camera , also attached on the player capsule is a walking jumping controller that also plays sounds it doenst work at all , also the enemies in the level are not moving iam wondering how to deal with nav mesh as well … so none of my previous scripts worked … sorry to many questions hoping someone could point me to a good direction … i would like to get a simple FPS level working so that i could fill it up with my own objects and sounds that all i want to do for now .

thank you

Hello @Mahmoud_Ismail

you can get access to all sample scene via the Unity Plugin. Open the menu item “Needle Engine/Explore Samples” and double click the scene that you’re interested in

hello ,

thank you for the answer , yes i have noticed that but there is only 5 examples there , i am interested in this one

which one of them have the FPS controller ؟

thank you

You can find it in the Samples Window in Unity :slight_smile:

1 Like

great thank you very much i found it , i have another question :

so from now on if i would like to write scripts to develop on this template as my base , what should i be aware of ? for example sound scripts that play sound … foot steps etc all the basic stuff like Navigation mesh … some animations ? i usually use chatgpt to do this task as i am not a coder my self ? thank you