I am making a showroom type scene and use a laserpointer to point out parts of an object.
It works fine, but i would like the laser to make a small red dot where it collides with a part.
Right now the part just breaks the laser beam.
How can i do that?
I use this script for the laser:
using UnityEngine;
using System.Collections;
public class Laser : MonoBehaviour
{
private LineRenderer lr;
// Use this for initialization
void Start()
{
lr = GetComponent<LineRenderer>();
}
// Update is called once per frame
void Update()
{
lr.SetPosition(0, transform.position);
RaycastHit hit;
if (Physics.Raycast(transform.position, transform.forward, out hit))
{
if (hit.collider)
{
lr.SetPosition(1, hit.point);
}
}
else lr.SetPosition(1, transform.forward * 5000);
}
}
The AngryBots example/demo had a nice laser effect (for Aiming). It’s for an older version of Unity but you could give it a try.
How can you know that when you don’t try it? Try, fail, ask for help and learn from it. Just copying what others do for you helps you nothing (in regards to learning). So don’t be shy.
You can apply most solutions made for bullet holes like decals, should be even simpler because you don’t need a normal map like a hole/crack - not that a normal map is that much more work.
i might be repeating what the other guys said about the projectors, this might be what unity calls decals in the SRP i havn’t had too much experience with it yet
Another easy laser-dot effect is to make a particle system with zero-speed particles, and give them some shimmering colors and varying sizes… that will give it a nice dynamic sizzling look if you do it right.