[Solved?] Is there any good way to render laser beams?

Started by Sajevius on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Solved?] Is there any good way to render laser beams?
Fri, 03/05/2021 - 01:48 (edited)

basically, I wanted to make a laser beam that fires in a straight direction (quite needless to say lol), damaging mobs that collide with it. so far, I've already set up the way to damage entities (using a lot of raytracing and "for each entity" procedures), and it was a success! (although I think the entire procedure I made is not too optimal). for the visible beam, I've been using the raytrace blocks and spawning particles of choice (I tried using a lot of spawn particle procedures to try and produce a ray directed towards the direction the player's looking at), but the problem is that the particles ended up looking unorganized, thus making it not even look like a beam at all! I wonder if making an accurate-looking ray is possible within the limitations of MCreator. is it? :/

 

EDIT 3/5/2021: a solution for particle-based beams has been found! (thanks for the help!) now I just need to know how to make beacon-like rays, if possible

Edited by Sajevius on Fri, 03/05/2021 - 01:48
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could try shooting the…
Sun, 02/14/2021 - 13:18

you could try shooting the particles at that direction instead of creating no motion particles in the path of the beam.

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Giving the particles motion…
Sun, 02/14/2021 - 13:51

Giving the particles motion is what I did to make the lasers on my claymore mine, I would recommend doing that. I adapted this procedure in order to make the particles move in the direction the mine was facing: https://mcreator.net/forum/58735/move-direction-youre-facing

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@TheCatalystGaming I tried…
Mon, 02/15/2021 - 01:21

@TheCatalystGaming

I tried giving motion to the particle/s as you said (following the procedure at https://mcreator.net/forum/58735/move-direction-youre-facing & changing some parameters), but unfortunately, it didn't work for me. it just spawned the particles under the player and they didn't even move anywhere...

I might've got something wrong... but I'm not sure what. here's the procedure I made:

laser beam procedure

(I put this in my item's "When right-clicked in air" trigger, as the damage procedure was also there)

 

could you send a screenshot of the procedure you made to achieve a laser beam effect?

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is the procedure I used…
Mon, 02/15/2021 - 21:49

Here is the procedure I used:

https://i.imgur.com/lN3xKQx.png

Link if image doesn't show: https://imgur.com/a/0Dr3NQE

Your procedure doesn't seem much different, although it does produce some high values (That might be what you're aiming for though)

I changed the particle on one of my claymores lasers to the dragon's breath particle and it still moved, so the particle itself isn't the problem. I can't see any issues looking at it, but hopefully this will help.

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1. if you want to use the…
Tue, 02/16/2021 - 04:59

1. if you want to use the player rotation, you'll need to use the player head yaw, not player yaw. use a code snippet block and put in something like "player_yaw=entity.getRotationYawHead();"

2. i think its better to use the "look x/y/z position of entity with raytrace distance n" code blocks instead of player rotation, your calculations are not correct. do something like speed x "look x/y/z position with raytrace 2" and put in vx, vy, vz. play around with the speed variable to get the speed right

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it works! thank you both!  …
Fri, 03/05/2021 - 01:37

it works! thank you both!

 

P.S. been quite a while since I last visited this forum topic. if you guys have wondered where I've been, I was recently busy working on Betterlands, and outside of that I've been coming up with a more optimized procedure to deal damage in a "straight" line (still using raytrace blocks). and I've found a working solution for the damage, which I might share on a new user-side tutorial forum topic if I have the time.

so yeah, thanks again!

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also, one last thing. I…
Fri, 03/05/2021 - 01:43

also, one last thing. I originally wanted the laser beam to render either like a beacon beam, or a guardian/elder guardian's laser beam attack. might I ask if there a way to achieve either of those, and what code it takes to make?

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
there's* 
Fri, 03/05/2021 - 01:44

there's* 

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, how can you make a…
Mon, 05/17/2021 - 14:57

Yeah, how can you make a beacon-like beam, something like the one in Mowzie's Mobs that the sun chief uses, or like the spiral one the guardians use?

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunately I don't know…
Mon, 05/17/2021 - 22:50

Unfortunately I don't know how to create a beam not made of particles. Also, I would love to see a user-side tutorial about this laser beam you've made, it would help a lot of people!

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it's okay, i think I'll just…
Mon, 05/17/2021 - 23:10

it's okay, i think I'll just learn how to code one (like, if I get it right, visuals for particle-less beams use special renderers or something, perhaps I'll take a look at the MC source code and check how beacon beam works; but if i fail there, i might continue using particles as it's a good alternative too). and as for the laser beam, a tutorial is coming very soon! :)