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
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 7th_zorro), 1,203 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: LASER Particle [C-SCRIPT] [Re: alibaba] #283562
08/08/09 12:36
08/08/09 12:36
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Looks good smile Thank you bro! But some questions... laser passes through the models and level blocks, how to fix that? And one more question, how to add "effect_LaserAim" to the vertex on model? So it will start from vertex on gun, I need to use vec_for_vertex I think... but how?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: LASER Particle [C-SCRIPT] [Re: 3run] #283564
08/08/09 12:44
08/08/09 12:44
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Alright, I changed some stuff, make sure to look at the comments:
Code:
bmap laserAim_map = "myLaserAimBitmap.bmp";

var laserAim_status = 0;

function effect_LaserAim()
{
	my.alpha = 60;
	my.bmap = laserAim_map;
	my.move = on;
	my.bright = on;
	my.beam = on;		// if beam doesn't look good, try my.streak = on; instead
	my.lifespan = 1;
}

function toggle_LaserAim()
{
	laserAim_status = !laserAim_status;
	
	var laser_pos[3];
	
	while(laserAim_status)
	{
		// Assumption: laser_pos is a vector which represents the current position
		// of the laser beam start
		
		vec_for_vertex(laser_pos,gun_entity,123); // fill in the correct data here
		
		vec_set(temp,vector(10000,0,0)); // length of your laser beam
		vec_rotate(temp,camera.pan);
		
		c_trace(laser_pos,temp,IGNORE_ME|IGNORE_PASSABLE);
		
		vec_set(temp,target.x);
		vec_sub(temp,laser_pos);
		
		effect(effect_LaserAim,1,laser_pos,temp);
		
		wait(1);
	}
}



Re: LASER Particle [C-SCRIPT] [Re: Xarthor] #283567
08/08/09 13:09
08/08/09 13:09
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Thank you Xarthor! It works but it still passes through the models and level blocks frown


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: LASER Particle [C-SCRIPT] [Re: 3run] #283577
08/08/09 14:36
08/08/09 14:36
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Some bugs... laser is aiming to the center of the screen only when I'm looking to level blocks or when I'm inside the room, when I go outside laser aims to the right side... frown Do not know what to do..


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: LASER Particle [C-SCRIPT] [Re: 3run] #283579
08/08/09 15:20
08/08/09 15:20
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Well the code snippet I provided takes the camera angle and displays a particle beam into that direction.
So if you work on a 3rd person shooter this might not be the case.
In this case you would have to find another way to calculate the direction of the laser.
So as long as you don't give more information about the environment in which this laser is supposed to work, I cannot help you any further.

Re: LASER Particle [C-SCRIPT] [Re: alibaba] #283589
08/08/09 16:29
08/08/09 16:29
Joined: Oct 2008
Posts: 681
Germany
Ayumi Online
User
Ayumi  Online
User

Joined: Oct 2008
Posts: 681
Germany
ssooo,
fertig;)

->looks here:Waffentut_eng
http://www.megaupload.com/?d=W8DJZ6G1

-> or in my signature

Re: LASER Particle [C-SCRIPT] [Re: Ayumi] #283607
08/08/09 18:57
08/08/09 18:57
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Thank you man! Thank you for that great work you'v done!!!! smile Downloading now)) Xarthor I'm making 3rd person shooter, camera in on the players shoulder. All I whant is to make laser start from vertex on players gun and point the way straight... just straight. Not to the screen center. And how to make it do not pass models and level geometry?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: LASER Particle [C-SCRIPT] [Re: 3run] #283609
08/08/09 19:06
08/08/09 19:06
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline
Serious User
jigalypuff  Offline
Serious User

Joined: Nov 2005
Posts: 1,007
Thank you ayumi this is very decent of you smile
Should i get the chance i will return the favour smile


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: LASER Particle [C-SCRIPT] [Re: jigalypuff] #283667
08/09/09 08:08
08/09/09 08:08
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
@3run:
What you need is a second vertex or the angle of the gun itself.
I would go with a second vertex to have two points to calculate the direction of the laser.
Now if you have this you calculate the direction:
Code:
...
vec_for_vertex(pos_front,...); // starting position of the laser
vec_for_vertex(pos_back,...); // a vertex behind it but on the line of the laser

vec_set(temp,pos_front);
vec_sub(temp,pos_back);

// now temp is the difference and thus direction from pos_back to pos_front
// we now normalize it to a specific length
vec_normalize(temp,10000);

// now we add the pos_front vector to it to get the end vector
vec_add(temp,pos_front);

// now you trace from pos_front to temp
c_trace(pos_front,temp,IGNORE_PASSABLE);
...



Page 2 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

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