Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (fairtrader, AndrewAMD, 3run), 576 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Einschussloch #159647
10/08/07 11:19
10/08/07 11:19
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Hi,

ich möchte gerne wissen, wie man einem sprite sagen soll, das es sich an der Wand, die am nächsten ist, sich dran hefftet??? Ich brauche das für meine Einschusslöcher. Das Sprite wurde per Code eingefügt.

Mfg, Pingulord


3D Gamestudio A7 Extra
Re: Einschussloch [Re: Martek] #159648
10/08/07 11:38
10/08/07 11:38
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
>> normal << macht den unterschied

Re: Einschussloch [Re: Xarthor] #159649
10/08/07 11:52
10/08/07 11:52
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Cool, aber es klappt tortzdem net. Das ist meine Funktion, die dem Sprite zugewiesen wird:
Code:
 function hole_func()
{
vec_set(my.x, temp);
temp.x -= 100;
c_trace(my.x, temp, ignore_passable + ignore_me);
if(result != 0)
{
vec_to_angle(my.pan, normal);
}
}



Mfg, Pingulord


3D Gamestudio A7 Extra
Re: Einschussloch [Re: Martek] #159650
10/08/07 11:58
10/08/07 11:58
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Welche herangehensweise benutzt du denn für das "schießen"?
Trace oder ein model was irgendwo hin fliegt?

Re: Einschussloch [Re: Xarthor] #159651
10/08/07 12:58
10/08/07 12:58
Joined: Apr 2005
Posts: 3,076
Germany, NRW
rvL_eXile Offline

3D Artist
rvL_eXile  Offline

3D Artist

Joined: Apr 2005
Posts: 3,076
Germany, NRW
Soweit ich weiß benutzt er Trace... Mach doch maln Beispiel für Trace und "bewegendes Model" dann kann ich das auch benutzen da ich ein "bewegendes Model" hab als Schuss

cYa Sebastian


Tutorials:
[Blender]Terrain creation ENG/GER
[Blender]Low Poly Tree Modeling
[GIMP]Create a Texture for Terrains
CLICK HERE


Re: Einschussloch [Re: rvL_eXile] #159652
10/08/07 13:18
10/08/07 13:18
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Genau wie rvL_eXile gesagt hat.
Ich Trace. Aber das dumme Loch will net stehen bleiben, es dreht sich immer schön nachm Player:(

Mfg, Pingulord


3D Gamestudio A7 Extra
Re: Einschussloch [Re: Martek] #159653
10/08/07 13:51
10/08/07 13:51
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
bei älteren versionen my.oriented=on; oder sonst muss pan!=0 sein( also erst an die wand pappen und danach if(my.pan==0){my.pan=0.001;} )

und mach am besten noch vec_add(my.x,normal); ,weil es sont zu einem unschönen flimmereffekt kommt, weil das sprite exakt an der wand ist und so sorting fehler auftreten

Last edited by 5c0rp10n; 10/08/07 13:52.
Re: Einschussloch [Re: Scorpion] #159654
10/08/07 15:01
10/08/07 15:01
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Also ich habe A7, und das mit dem if(my.pan == 0)... klappt net, auch net wenn ich noch vec_add(my.x, normal); dran hänge. Habs auch mit vec_add(my.pan, normal); probiert. Diese doofen sprites...

Mfg, Pingulord


3D Gamestudio A7 Extra
Re: Einschussloch [Re: Martek] #159655
10/08/07 15:36
10/08/07 15:36
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
aussem manual:
If its pan or tilt angle is nonzero, the sprite is oriented in world space according to its angles[...]For an angle to be nonzero it's sufficient to set it at a small amount, like 0.01.

ich denke mal, du erstellst die einschusslöcher direkt nach dem trace, also kannst du ohne probleme auch target verwenden, hier ist der code den ich für einschusslöcher(sprites) verwenden würde(und auch habe)

Code:
function hole_func()
{
vec_to_angle(my.pan, normal);
if(my.pan == 0)
{
my.pan = 0.001;
}
vec_add(my.x,normal);
}



edit: und das einschussloch kann dann so erstellt werden;

Code:
[...]

c_trace(camera.x,shoot_to,ignore_me + ignore_passable);
ent_create("bullet_hole.tga",target.x,hole_func);

[...]



Last edited by 5c0rp10n; 10/08/07 15:40.
Re: Einschussloch [Re: Scorpion] #159656
10/08/07 15:56
10/08/07 15:56
Joined: Sep 2003
Posts: 648
Switzerland
snake67 Offline
User
snake67  Offline
User

Joined: Sep 2003
Posts: 648
Switzerland
Quote:

aussem manual:
If its pan or tilt angle is nonzero, the sprite is oriented in world space according to its angles[...]For an angle to be nonzero it's sufficient to set it at a small amount, like 0.01.

ich denke mal, du erstellst die einschusslöcher direkt nach dem trace, also kannst du ohne probleme auch target verwenden, hier ist der code den ich für einschusslöcher(sprites) verwenden würde(und auch habe)

Code:
function hole_func()
{
vec_to_angle(my.pan, normal);
if(my.pan == 0)
{
my.pan = 0.001;
}
vec_add(my.x,normal);
}



edit: und das einschussloch kann dann so erstellt werden;

Code:
[...]

c_trace(camera.x,shoot_to,ignore_me + ignore_passable);
ent_create("bullet_hole.tga",target.x,hole_func);

[...]






Das funktioniert gut, bis die Anzahl der Sprites zu hoch wird. Besser ist es, zu Beginn einen Pool von Einschusslöcher-Sprites zu erstellen und deren Handles in einem Array zu speichern und alle auf unsichtbar stellen. Wird eines gebraucht, so wie oben vorgehen, jedoch nur sichtbar machen und auf Position setzen. Das könnte dann so aussehen:
Code:

// -----------
define _max_bulletholes, 50;
var bullet_hole_handle[_max_bulletholes];
var bullethole_ptr;
entity* bullethole_last;
// -----------
function bullet_hole()
{
bullethole_ptr+=1;
if(bullethole_ptr>=_max_bulletholes) {bullethole_ptr=0;}
me=ptr_for_handle(bullet_hole_handle[bullethole_ptr]);
bullethole_last=me;
my.alpha=80;
vec_set(my.x, target.x);
vec_to_angle(my.pan, normal.x);
vec_set(temp.x, normal.x);
vec_normalize(temp.x, 0.5);
vec_add(my.x, temp.x);
my.invisible=off;
my.frame=material_hit;
sleep(5);
while(my.alpha>0)
{
wait(1);
my.alpha-=time;
}
my.invisible=on;
}
// -----------
function bullet_hole_sprite()
{
my.passable=on;
my.oriented=on;
my.invisible=on;
my.transparent=on;
my.scale_x=0.20;
my.scale_y=my.scale_x;
}
// -----------
function bullet_holes_init()
{
bullethole_ptr=0;
while(bullethole_ptr<_max_bulletholes)
{
bullet_hole_handle[bullethole_ptr]=handle(ent_create("bulletholes+5.tga",
nullvector, bullet_hole_sprite));
bullethole_ptr+=1;
}
bullethole_ptr=0;
}
// -----------



Page 1 of 2 1 2

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