Aiming Laser with C# & Godot [Andromedoom Dev Log 8]
Polysthetic
๐พWelcome to the Andromedoom dev logs! In episode 8, I'm showing you how I implemented the aiming laser that turns red when underneath the shields and green when underneath aliens. This is done in script with a ray cast node that uses an immediate geometry node and a spatial material. I didn't have much to report on the development in this episode, so I appended a speed modelling video of the Velocitractor. I hope you enjoy this video series and stick around for the game's development! ๐
โฑ๏ธ Timestamps: 0:00 Intro 0:55 Initialising the ray cast node 2:00 Scripting - Checking collisions with Godot groups 5:45 Scripting - Drawing a laser using Immediate Geometry 7:32 Scripting - Changing colours on the material for the laser 9:35 Updating the collision masks on the ray cast and debugging the laser length 10:30 Debugging crashing using GetCollider() instead of IsColliding() 11:15 Conclusion 11:54 Speed modelling the Velocitractor
๐ป Addenda:
- Instead of using an emission material, you can set "material.FlagsUnshaded = true;" and then use "materal.AlbedoColor" to set the colour of the laser. This material will be completely unresponsive to the environment and be visible in the exact desired colour.
- It would also be better to "[Export] Godot.Color" fields so you can set the exact colours you want in the editor instead of hard-coding them into the scripts.
- The proper way to get the end point laser position is to actually subtract the Global origin of the ray cast from the global origin of the collided object, then only take the y component. In this case it didn't matter, because the player doesn't move along the y axis. If you're thinking of implementing this method, always draw arrows and figure out how the vectors add up in global space to make calculating the correct point easy.
๐ถ Music tracks from:
- Kalaido - Ghosts of the Floating World
- Provided by Lofi Girl
- Listen: https://fanlink.to/GhostsOfTheFloatingWorld
You can also visit me at: WEBSITE ๐ https://polysthetic.com THREADLESS ๐ถ๏ธ https://polysthetic.threadless.com DRIBBBLE ๐ https://dribbble.com/polysthetic YOUTUBE ๐ฅ https://youtube.com/c/polysthetic AUDIOMACK ๐ผ https://audiomack.com/polysthetic ... https://www.youtube.com/watch?v=iFs8Qwm9p3A
165385782 Bytes