How have you made the lightsaber mechanics work? would love to see source code/unity project. thanks
Hey, I appreciate you enjoyed the game so much that you want to make your own version, I understand the sentiment.
But for obvious reasons I am not going to share the whole unity project as this used to be a commercial endeavour and in any case it costed me months of hard work.
I can although point you in the same direction I took when I started making the game:
- For the physics simulation I used this framework: https://github.com/TomorrowTodayLabs/NewtonVR?tab=readme-ov-file
This framework is quite outdated nowadays, but it should still work with some tweaking, I don't necessarily reccommend it as it is really old, but you can find some really good code in there!
- For the shaders, I had to make my own "Lightsaber" shader with custom mesh generation. It works similarly to Unity's trail renderer.
I can't share my own source code, but a quick Google search finds this project that could be good for you: https://github.com/jjxtra/UnityLaserSword?tab=readme-ov-file - FInally, for the enemy AI, it's all custom built, it's a physics-based model that predicts the next hit from the player and tries to intercept it to parry, mixed with a regular animation for the swinging. The drones are much more basic than that.
I hope that points you in the right direction. Alongside this I also released a full devlog on how I made most parts of the game and you can find them here: Playlist