I have an example of a fps game it has an octree that works but i cant for the life fo me figure out how to put it into a vite project and get it to run?
These are the steps you have to go through in order to make the project run on vite:
- Run
npm vite initin the shell to initiate the vite directory - Select
Vanilla, enter your project name and after that select JavaScript since the project is made in.js. - Next you have to cd into the vite directory, in order to install the packages and modify the files.
- After entering the vite directory run the command
npm install - After that inside the
index.htmldeletestyle.css,main.js,counter.jsandjavascript.svgfile. - Inside the
index.htmlfile remove everything and paste thegames_fps.htmlcode in theindex.html. - Create a new
main.cssfile and paste thismain.csscode in that. - Now inside the
index.htmlreplace:
<script type="importmap">
{
"imports": {
"three": "../build/three.module.js",
"three/addons/": "./jsm/"
}
}
</script>
with:
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.165.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm//three@0.165.0/examples/jsm/",
}
}
</script>
- Now just run
npm run devand you are good to go.
2 Likes
THANK YOU SO MUCH! I didnt expect someone to respond. You are my HERO!!!
1 Like