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 (M_D), 1,430 guests, and 3 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 1 of 3 1 2 3
Ugly Bulletholes #279802
07/19/09 11:52
07/19/09 11:52
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Hello Guys!
I finally got my 3rd erson gun but there are so many problems frown . Please don´t say that my View is ugly - I know, it is just for testing.

Here are the pics:

Ugly!

Wrong!
You can see that there are really ugly and wrong.

Code:
Code:
c_trace(temp2, temp, IGNORE_PASSABLE | IGNORE_ME | IGNORE_YOU | USE_POLYGON | ACTIVATE_SHOOT | GET_HITVERTEX);
ent_create("bullet_hole.tga",target,bullet_hole);


Calls the bullet hole and creates it at the target position.
Bullet Hole Code:
Code:
function bullet_hole()		//die Funktion die die Einschusslöcher erstellt
{
	vec_to_angle(my.pan, normal);		//setzt den Winkel auf nciht der Camera anpassen
	my.scale_x = 1;						//scaliert das Bild
	my.scale_y = 1;
	my.scale_z = 1;
	set(me, OVERLAY | TRANSLUCENT | PASSABLE);	//setzt das Bild auf PASSABLE, Durchsichtig und Schwar ausblenden
	my.alpha = 100;										//setzt die duchsichtig keit auf 0
	wait(-5);												//warte 5 sekunden
	while (my.alpha > 0)									//solange das bild weniger als 100 % durchsichtig ist
	{
		my.alpha -= 0.25*time_step;					//erhöhe die durchsichtigkeit
		wait(1);
	}
	ptr_remove(me);										//entferne das Bild
}


Hope you understand the code wink!

Nearly every reply is a good reply!

Re: Ugly Bulletholes [Re: Rei_Ayanami] #279826
07/19/09 14:16
07/19/09 14:16
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
It got Worser frown !
Iamge:
why is that so?
Weapon Code:
Code:
function pistol_shoot()									//die Schuss Funktion, solange ich nciht wieß wieviele waffen es gibt bleibt es bei der Pistole
{
	VECTOR temp, temp2;									//2 lokale Vectoren
	var i;													//lokale hochzähl-variable
	temp.x = mouse_pos.x;								//setzt lokalen Vector 1 X auf die mouse x position
	temp.y = mouse_pos.y;								//setzt lokalen Vector 1 Y auf die mouse y position
	temp.z = camera.clip_far;							//setzt lokalen Vector 1 Z auf die Fern enfernung der Camera
 	vec_for_screen(temp, camera);						//konvertiert die durch den Vektor angegebenen XY-Bildschirmkoordinaten in eine Welt-Position
	you = player;											//du bist der Spieler
	vec_for_vertex(temp2, pistol, 797);				//setzt lokalen Vector 2 (Temp 2) auf die mündung 
	vec_sub(temp, temp2);								//berechnet den Winkel
	c_trace(temp2, temp, IGNORE_PASSABLE | IGNORE_ME | IGNORE_YOU | USE_POLYGON | ACTIVATE_SHOOT | GET_HITVERTEX);			//traced von vector 1 zu vector 2
	gun_flash();
	if(you!=NULL)											//wenn du Irgenwas bist auser die Level Wand
	{
		wait(1);												//noch nichts
	}
	else
	{
		ent_create("bullet_hole.tga",target,bullet_hole);	//sonst erstelle das Einschussloch an der stelle des hinschießens
		//		effect(funkenspezial,10,target,nullvector); 	// Funkeneffekt am Ziel
	}
	return;							//beendet
}



Re: Ugly Bulletholes [Re: Rei_Ayanami] #279831
07/19/09 14:55
07/19/09 14:55
Joined: Aug 2008
Posts: 18
Germany
D
Der_Kekser Offline
Newbie
Der_Kekser  Offline
Newbie
D

Joined: Aug 2008
Posts: 18
Germany
warum benutzt du keine Decals?

dann kann die function bullet_hole weg und in der function pistol_shoot ersetzt du
Code:
ent_create("bullet_hole.tga",target,bullet_hole);


mit:
Code:
ent_decal(NULL,"bullet_hole.tga",0,0);



und bei dem c_trace noch SCAN_TEXTURE als mode angeben.

Re: Ugly Bulletholes [Re: Rei_Ayanami] #279833
07/19/09 15:12
07/19/09 15:12
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
try to add the normal to the position of the bullet hole
Code:
vec_add(my.x,normal);


or better: use decals for your bulletholes

About the wrong position of the bullet holes: you are defining a position FAAR behind that wall and if you draw a line from the gun to that position, it crosses the wall on a different part.
instead use a trace from the cursor to a position way behind the cursor to get the position of the shot.

for determine if you hit an enemy you need a second trace

this code should to the job. -did not tested it- enjoy!

edit: habs SCAN_TEXTURE vergessen..danke der kekser =]

Code:
void createBullethole(VECTOR* pos, VECTOR* n, int chunk){
	vec_set(hit.x, pos);
	vec_set(hit.nx, n);
	hit.chunk = chunk;
	hit.model = NULL;
	PARTICLE* p = ent_decal(NULL, "bullet_hole.tga", 8, random(360));

	//here you can set up everything for the bullet hole, like a event and a material
	p.lifespan = 160; //remove after 10 secs
}

void pistol_shoot(){
	VECTOR from, to;
	
	//mouse_spot to get the middle of the crosshair
	vec_set(from, vector(mouse_pos.x + mouse_spot.x, mouse_pos.y + mouse_spot.y ,0);
	vec_set(to, from);
	to.z = camera.clip_far;
	
	vec_for_screen(from, camera);
	vec_for_screen(to, camera);
	
	c_trace(from, to, IGNORE_PASSABLE | IGNORE_ME | IGNORE_YOU | USE_POLYGON | SCAN_TEXTURE);
	
	int holeChunk = hit.chunk;
	VECTOR holePos;
	vec_set(holePos, target);
	VECTOR holeN;
	vec_set(holeN, normal);
	
	vec_set(to, target);
	vec_for_vertex(from, pistol, 797);
	
	c_trace(from, to, IGNORE_PASSABLE | IGNORE_ME | USE_POLYGON | ACTIVATE_SHOOT | GET_HITVERTEX);
	
	if(you==NULL){//hit nothing
		createBullethole(holePos, holeN, holeChunk);
	}
	else{
		your.health -= PISTOL_DAMAGE;
	}
}



Last edited by Scorpion; 07/19/09 15:16.
Re: Ugly Bulletholes [Re: Scorpion] #279836
07/19/09 15:25
07/19/09 15:25
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Crash in Bullet hole frown
Bt thanks very much, i have never worked with voids or scan_texture or things like this smile.

Re: Ugly Bulletholes [Re: Rei_Ayanami] #279837
07/19/09 15:29
07/19/09 15:29
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Also ihr könnt auch in Deutsch schreiben, fällt mir grad auf wink

Re: Ugly Bulletholes [Re: Rei_Ayanami] #279845
07/19/09 15:53
07/19/09 15:53
Joined: Jun 2008
Posts: 402
Germany
S
sebbi91 Offline
Senior Member
sebbi91  Offline
Senior Member
S

Joined: Jun 2008
Posts: 402
Germany
@Der_Kekser:
Ähh entschuldige mich wenn ich falsch liege aber ist die ent_decal function nicht eigendlich nur für A7 7.10 (Commercial,Professional) verfügbar?
Steht jedenfalls so im Manual !http://www.conitec.net/beta/ent_decal.htm

Dem anschein nach nutzt er allerdings Lite-C FREE!
Sorry falls ich falsch liege ^^


3D-Gamestudio A8 - Commercial
Re: Ugly Bulletholes [Re: sebbi91] #279846
07/19/09 15:55
07/19/09 15:55
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
stimmt, ab A7 7.10 nur mit Com und Prof verfügbar frown

Re: Ugly Bulletholes [Re: Rei_Ayanami] #279851
07/19/09 16:02
07/19/09 16:02
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
//instead use a trace from the cursor to a position way behind the cursor to get the position of the shot.

As a variant, you can try to trace from gun to your target coordinates in 3d, then find place, where your bullet will co,lline with obstacle and then place crosshair picture there.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Ugly Bulletholes [Re: VeT] #279853
07/19/09 16:10
07/19/09 16:10
Joined: Aug 2008
Posts: 18
Germany
D
Der_Kekser Offline
Newbie
Der_Kekser  Offline
Newbie
D

Joined: Aug 2008
Posts: 18
Germany
Oh, hab ich nicht dran gedacht, dass ent_decal für Com und Pro ist, habe persönlich nähmlich Com, sry

Page 1 of 3 1 2 3

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