Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (TedMar), 1,420 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to create a laser beam #410669
11/07/12 00:17
11/07/12 00:17
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
Hi guys,
i want to create something like laser beam, whose spot size is decreasing the more distant the hit object is. my aim is to create something like a distance measuring simulation. Depending on the beam spot size the distance to an object should be calculated. can me help someone to get a with distance decreasing laser beam spot.

thanks in advance

Re: how to create a laser beam [Re: pjotr987] #410671
11/07/12 00:36
11/07/12 00:36
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You can measure the distance with c_trace and create a beam with a particle that got its BEAM flag set. You then need done additional particle at the end of the beam and increase its size with growing distance.


Always learn from history, to be sure you make the same mistakes again...
Re: how to create a laser beam [Re: Uhrwerk] #410812
11/09/12 13:05
11/09/12 13:05
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
is there any piece of code that throws a spot (like a spot of a laser) on hit surface?. this spot radius should decrease with the increasing distance of the hit area. like a spot of a torch, that is big if it hits a close wall and gets smaller if the wall is more distant. somehow i dont know how to start. frown

any help will be approciated
thanks in advance

Re: how to create a laser beam [Re: pjotr987] #410816
11/09/12 13:48
11/09/12 13:48
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
It will automatically get smaller because of perspective, but you can do it manually, too (however, this would be unrealistic).
Uhrwerk already told you how to achieve it, check the manual for c_trace(), vec_rotate(), hit.x/ "target" and effect() or ent_decal().


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: how to create a laser beam [Re: Superku] #411038
11/12/12 13:51
11/12/12 13:51
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
thanks for replies guys.
finaly i managed to plot a white circle (png sprite) on the c_trace hitted place. the thing now is, that this circle is alleays round. i want to stretch it in one axis according to the angle the beam hits the wall (to make it look more realistic). so now i have to get the angle with which the c_race is hitting the wall.
can someone give me an idea how to get this angle.

thanks in advance

Re: how to create a laser beam [Re: pjotr987] #411040
11/12/12 13:56
11/12/12 13:56
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Originally Posted By: pjotr987
thanks for replies guys.
finaly i managed to plot a white circle (png sprite) on the c_trace hitted place. the thing now is, that this circle is alleays round. i want to stretch it in one axis according to the angle the beam hits the wall (to make it look more realistic). so now i have to get the angle with which the c_race is hitting the wall.
can someone give me an idea how to get this angle.

thanks in advance


Use the normal vector laugh

Re: how to create a laser beam [Re: Ch40zzC0d3r] #411042
11/12/12 14:19
11/12/12 14:19
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
so the normalvector seems to be a step in the right direction, but i still dont get the right angle with which the c_trace hits the wall. the code below delivers only angles in 90° steps (90,180 and 270) and not the real angle.

var winkel=my.pan;
vec_to_angle(winkel, normal);

any ideas how to solve it?

thanks for any help

Re: how to create a laser beam [Re: Ch40zzC0d3r] #411043
11/12/12 14:20
11/12/12 14:20
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You will need to use a (sprite) entity or ent_decal (where the latter is probably the better choice), particles do not support angles.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: how to create a laser beam [Re: pjotr987] #411044
11/12/12 14:22
11/12/12 14:22
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You cannot use a fixed skalar where an angle is expected. The functions signature is vec_to_angle(ANGLE* ang, VECTOR* dir).


Always learn from history, to be sure you make the same mistakes again...
Re: how to create a laser beam [Re: Uhrwerk] #411051
11/12/12 16:05
11/12/12 16:05
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
lol, Change the vel_x, y, z...

Last edited by Ch40zzC0d3r; 11/12/12 16:05.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1