Jump to content


Photo

Problem with the 3d weapon


  • Please log in to reply
21 replies to this topic

#1 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 25 March 2012 - 01:27 PM

Hello! I am new to this site and I wanted to ask for help for a problem in my current project, First of all, my English will not be 'very good because I'm Italian and I've never been good at English.
So, I've seen other topics on this subject, on depht weapon 3d, I tried the method of "d3d_set_hidden (false) / d3d_set_hidden (true) but as already 'seen funsiona bad for hidden surfaces, while I have not understood how the second "d3d_set_projection_ext ()" in projecting the weapon, is one of the few mistakes that I have left to solve in my game and I would be very grateful if someone could help me, so if anyone knows' how to solve my the problem please help!
  • 0

#2 Ashley Phoenix

Ashley Phoenix

    GMC Member

  • GMC Member
  • 316 posts
  • Version:Unknown

Posted 25 March 2012 - 01:47 PM

Hello! I am new to this site and I wanted to ask for help for a problem in my current project, First of all, my English will not be 'very good because I'm Italian and I've never been good at English.
So, I've seen other topics on this subject, on depht weapon 3d, I tried the method of "d3d_set_hidden (false) / d3d_set_hidden (true) but as already 'seen funsiona bad for hidden surfaces, while I have not understood how the second "d3d_set_projection_ext ()" in projecting the weapon, is one of the few mistakes that I have left to solve in my game and I would be very grateful if someone could help me, so if anyone knows' how to solve my the problem please help!


Well, if you have d3d_set_culling enabled.

Try: d3d_set_culling(false). Then draw your weapon. Then d3d_set_culling(true)

Or you could set the depth of the object that's drawing your weapon to 99999 so it will be drawn after everything else(on top)

Edited by Ashley Phoenix, 25 March 2012 - 01:48 PM.

  • 0

#3 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 25 March 2012 - 02:20 PM


Hello! I am new to this site and I wanted to ask for help for a problem in my current project, First of all, my English will not be 'very good because I'm Italian and I've never been good at English.
So, I've seen other topics on this subject, on depht weapon 3d, I tried the method of "d3d_set_hidden (false) / d3d_set_hidden (true) but as already 'seen funsiona bad for hidden surfaces, while I have not understood how the second "d3d_set_projection_ext ()" in projecting the weapon, is one of the few mistakes that I have left to solve in my game and I would be very grateful if someone could help me, so if anyone knows' how to solve my the problem please help!


Well, if you have d3d_set_culling enabled.

Try: d3d_set_culling(false). Then draw your weapon. Then d3d_set_culling(true)

Or you could set the depth of the object that's drawing your weapon to 99999 so it will be drawn after everything else(on top)


  • 0

#4 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 25 March 2012 - 02:29 PM

Sorry I replied I did not know how to respond ...
I put the gun in the projection
d3d_set_hidden (false)
d3d_set_culling_ (false)
d3d_draw_model (ind, .....)
d3d_set_culling (true)
d3d_set_hidden (true)
and I set the depht as the lesser of the game except obj_player
(I had read in a previous post) but I read that script I had to draw the weapon add a d3d_set_projection_ext () I did not understand, if you can 'esserti agliutarmi useful (perhaps better than I understand the English ... ) the post I read is this:
http://gmc.yoyogames...howtopic=491079
  • 0

#5 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 26 March 2012 - 06:36 PM

Sorry I replied I did not know how to respond ...
I put the gun in the projection
d3d_set_hidden (false)
d3d_set_culling_ (false)
d3d_draw_model (ind, .....)
d3d_set_culling (true)
d3d_set_hidden (true)
and I set the depht as the lesser of the game except obj_player
(I had read in a previous post) but I read that script I had to draw the weapon add a d3d_set_projection_ext () I did not understand, if you can 'esserti agliutarmi useful (perhaps better than I understand the English ... ) the post I read is this:
http://gmc.yoyogames.com/index.php?showtopic=491079


Ehi, sono Italiano anche io, forse posso aiutarti :)
Credo che il tuo problema dipenda dal fatto che usi un modello per la tua arma. d3d_set_projection_ext () serve a "proiettare" sulla telecamera ciò che c'è sul piano 2D. Se stai usando un modello 3D, quel codice non serve a nulla. Prova a cancellarlo e a creare l'arma in basso a destra del personaggio.
  • 0

#6 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 28 March 2012 - 07:16 PM

Sono molto felice che ci sia un italiano che possa fare a meno di decifrare il mio inglese. :)
Allora io ho sempre usato per la proiezione dell arma in draw lo stesso player che proietta anche l'interfaccia, seguendo un post ho provato a separare l'arma dal player, fin li' ci sono riuscito, ho abbassato il depth dell'arma ma non cambiava niente, poi ho provto con d3d_set_hidden, ma quello è utile solo per effetti strani, dato che rende visibili tutti gli spazi nascosti del modello 3d, quindi ho bocciato anche quel metodo, il fatto che avevo messo un secondo d3d_set_projection_ext è perche avevo visto un post( http://gmc.yoyogames...howtopic=491079 ) che risolveva il problema con una seconda proiezione, ovvero proiettando l'arma 3d in uno spazio 2d dell'interfaccia, ma non ho capito bene perche inserendo la seconda proiezione nell'ogetto dell'arma non dà risultati, anzi fà un vero e proprio "casino" dato che l'arma schizza da un lato all'altro della mappa, io non sò come risolvere il problema...mi serve molto perche mi sono trovato a fare una mappa del gioco in cui ci sono spazzi stretti (coridoi,cunicoli,pareti vicine) e l'arma non si vede quasi mai "intera" e quindi se voglio proseguire ne ho bisognio di capirlo, ma tu hai mai fatto un gioco 3d e se si come hai risolto il problema?

Edited by SF01, 28 March 2012 - 07:17 PM.

  • 0

#7 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 29 March 2012 - 05:25 PM

Sono molto felice che ci sia un italiano che possa fare a meno di decifrare il mio inglese. :)
Allora io ho sempre usato per la proiezione dell arma in draw lo stesso player che proietta anche l'interfaccia, seguendo un post ho provato a separare l'arma dal player, fin li' ci sono riuscito, ho abbassato il depth dell'arma ma non cambiava niente, poi ho provto con d3d_set_hidden, ma quello è utile solo per effetti strani, dato che rende visibili tutti gli spazi nascosti del modello 3d, quindi ho bocciato anche quel metodo, il fatto che avevo messo un secondo d3d_set_projection_ext è perche avevo visto un post( http://gmc.yoyogames...howtopic=491079 ) che risolveva il problema con una seconda proiezione, ovvero proiettando l'arma 3d in uno spazio 2d dell'interfaccia, ma non ho capito bene perche inserendo la seconda proiezione nell'ogetto dell'arma non dà risultati, anzi fà un vero e proprio "casino" dato che l'arma schizza da un lato all'altro della mappa, io non sò come risolvere il problema...mi serve molto perche mi sono trovato a fare una mappa del gioco in cui ci sono spazzi stretti (coridoi,cunicoli,pareti vicine) e l'arma non si vede quasi mai "intera" e quindi se voglio proseguire ne ho bisognio di capirlo, ma tu hai mai fatto un gioco 3d e se si come hai risolto il problema?

Allora, io ho creato e sto tutt'ora creando giochi in 3D, ma questo genere di problemi non mi è mai apparso. Dunque, da quello che io so, proiettare in 3D qualcosa in uno spazio 2D serve solo quando l'arma è uno sprite, perché serve a mostrare sullo schermo quello che altrimenti giacerebbe a terra. Se la tua arma è un modello 3d, allora devi assolutamente scartare la funzione in questione. Se invece è una sprite, ti consiglio di usare d3d_set_projection_ortho, perché la projection_ext viene di solito usata per la telecamera. Assicurati inoltre che il depth dell'arma sia superiore a quella di tutti gli altri oggetti, altrimenti tutti gli oggetti con la stessa depth verranno proiettati sullo schermo. Assegna un valore come -100
  • 0

#8 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 29 March 2012 - 06:26 PM

Allora io sto' lavorando con modelli 3d importati da obj,md2,gmmod e non su sprite 2d quindi il problema che volevo dire non centra con animazioni o sulla posizione dell'arma, bensi' sul fatto che quando il player va in contatto con un muro l'arma vi entra dentro, come un ologramma, non riesco a mettere immagini nel messaggio senno' ti farei vedere, avevo quindi letto che potevo mettere d3d_set_hidden(true)
d3d_set_hidden(false) ma da problemi, sia abbassando che alzando il depth dell'arma non funzione, come dici anche tu il d3d_set_projection_orto è un po' strano per una proiezione 3d e quindi non so' come procedere, nel post che avevo letto ( http://gmc.yoyogames...howtopic=491079 ) riuscivano a risolvere il problema ma non ho capito come...tu hai idee?
  • 0

#9 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 29 March 2012 - 06:41 PM

Allora io sto' lavorando con modelli 3d importati da obj,md2,gmmod e non su sprite 2d quindi il problema che volevo dire non centra con animazioni o sulla posizione dell'arma, bensi' sul fatto che quando il player va in contatto con un muro l'arma vi entra dentro, come un ologramma, non riesco a mettere immagini nel messaggio senno' ti farei vedere, avevo quindi letto che potevo mettere d3d_set_hidden(true)
d3d_set_hidden(false) ma da problemi, sia abbassando che alzando il depth dell'arma non funzione, come dici anche tu il d3d_set_projection_orto è un po' strano per una proiezione 3d e quindi non so' come procedere, nel post che avevo letto ( http://gmc.yoyogames...howtopic=491079 ) riuscivano a risolvere il problema ma non ho capito come...tu hai idee?

Anche io avrei usa usato d3d_set_hidden se devo essere sincero, ma visto che non ti funziona, ti direi di controllare bene il codice, per vedere se hai messo d3d_set_hidden(true) prima del codice d3d_draw_model(bla bla bla) e poi d3d_set_hidden(false) dopo. Posta il tuo codice pari pari com'è scritto, così vedo un po' u.u.
  • 0

#10 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 29 March 2012 - 08:54 PM

fd,f sono variabili per le animazioni, viene citato sempre obj_player perche l'oggetto è separato dal player e non hanno variabili in comune:

d3d_transform_set_identity()
d3d_transform_add_rotation_x(90)
d3d_transform_add_rotation_y(-obj_player.pitch +obj_player.f +obj_player.fd)
d3d_transform_add_rotation_z(obj_player.bearing -obj_player.aftermath)
d3d_transform_add_translation(obj_player.x,obj_player.y,obj_player.z);
d3d_set_hidden(false)
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player.f*2,3,obj_player.gun_h,background_get_texture(relife))
d3d_set_hidden(true)
d3d_transform_set_identity()

Anche in tal caso non va', ovvero non passa attraverso i muri, ma d3d_set_hidden(....) fà vedere "tutti" gli spazi nascoti dell'oggetto, in parole povere fa' un miscuglio di texture tra' la pare che vedo(sinistra) e quella che non vedo(destra) dell arma e rende il tutto estremamente orribile, disolito andrebbe usato per le superfici piane quindi non puo' andare con un arma 3d... forsepotrebbe andare facendo una seconda proiezione d3d_set_projection_ext come mel post che ti ho indicato perche li funsiona!!!, forse l'ho inserito nel punto sbagliato, l'ho messo prima del d3d_set_identity() della proiezione dell'arma, tu dove lo metteresti?
  • 0

#11 Robert3DG+

Robert3DG+

    VR Games

  • GMC Member
  • 1853 posts
  • Version:GM:Studio

Posted 30 March 2012 - 11:19 PM

The following general rules apply to the entire GMC forum. They're very simple, so please follow them.

  • Rules of Behavior
  • Please use English when posting. (You may chat by PM in whatever language you want)


If you guys aren't going to speak English so other people with the same problem or solution can understand it's best off you continue your discussion in PM for clarity's sake. Posted Image
  • 0

#12 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 31 March 2012 - 01:23 PM

fd,f sono variabili per le animazioni, viene citato sempre obj_player perche l'oggetto è separato dal player e non hanno variabili in comune:

d3d_transform_set_identity()
d3d_transform_add_rotation_x(90)
d3d_transform_add_rotation_y(-obj_player.pitch +obj_player.f +obj_player.fd)
d3d_transform_add_rotation_z(obj_player.bearing -obj_player.aftermath)
d3d_transform_add_translation(obj_player.x,obj_player.y,obj_player.z);
d3d_set_hidden(false)
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player.f*2,3,obj_player.gun_h,background_get_texture(relife))
d3d_set_hidden(true)
d3d_transform_set_identity()

Anche in tal caso non va', ovvero non passa attraverso i muri, ma d3d_set_hidden(....) fà vedere "tutti" gli spazi nascoti dell'oggetto, in parole povere fa' un miscuglio di texture tra' la pare che vedo(sinistra) e quella che non vedo(destra) dell arma e rende il tutto estremamente orribile, disolito andrebbe usato per le superfici piane quindi non puo' andare con un arma 3d... forsepotrebbe andare facendo una seconda proiezione d3d_set_projection_ext come mel post che ti ho indicato perche li funsiona!!!, forse l'ho inserito nel punto sbagliato, l'ho messo prima del d3d_set_identity() della proiezione dell'arma, tu dove lo metteresti?

Try this (T.T):

d3d_transform_set_identity()
d3d_transform_add_rotation_x(90)
d3d_transform_add_rotation_y(-obj_player.pitch +obj_player.f +obj_player.fd)
d3d_transform_add_rotation_z(obj_player.bearing -obj_player.aftermath)
d3d_transform_add_translation(obj_player.x,obj_player. y,obj_player.z);
d3d_set_hidden(true)
d3d_set_culling(true)
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player. f*2,3,obj_player.gun_h,background_get_texture(relife))
d3d_set_hidden(false)
d3d_set_culling(false)
d3d_transform_set_identity()
  • 0

#13 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 31 March 2012 - 01:23 PM

fd,f sono variabili per le animazioni, viene citato sempre obj_player perche l'oggetto è separato dal player e non hanno variabili in comune:

d3d_transform_set_identity()
d3d_transform_add_rotation_x(90)
d3d_transform_add_rotation_y(-obj_player.pitch +obj_player.f +obj_player.fd)
d3d_transform_add_rotation_z(obj_player.bearing -obj_player.aftermath)
d3d_transform_add_translation(obj_player.x,obj_player.y,obj_player.z);
d3d_set_hidden(false)
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player.f*2,3,obj_player.gun_h,background_get_texture(relife))
d3d_set_hidden(true)
d3d_transform_set_identity()

Anche in tal caso non va', ovvero non passa attraverso i muri, ma d3d_set_hidden(....) fà vedere "tutti" gli spazi nascoti dell'oggetto, in parole povere fa' un miscuglio di texture tra' la pare che vedo(sinistra) e quella che non vedo(destra) dell arma e rende il tutto estremamente orribile, disolito andrebbe usato per le superfici piane quindi non puo' andare con un arma 3d... forsepotrebbe andare facendo una seconda proiezione d3d_set_projection_ext come mel post che ti ho indicato perche li funsiona!!!, forse l'ho inserito nel punto sbagliato, l'ho messo prima del d3d_set_identity() della proiezione dell'arma, tu dove lo metteresti?

Try this (T.T):

d3d_transform_set_identity()
d3d_transform_add_rotation_x(90)
d3d_transform_add_rotation_y(-obj_player.pitch +obj_player.f +obj_player.fd)
d3d_transform_add_rotation_z(obj_player.bearing -obj_player.aftermath)
d3d_transform_add_translation(obj_player.x,obj_player. y,obj_player.z);
d3d_set_hidden(true)
d3d_set_culling(true)
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player. f*2,3,obj_player.gun_h,background_get_texture(relife))
d3d_set_hidden(false)
d3d_set_culling(false)
d3d_transform_set_identity()
  • 0

#14 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 31 March 2012 - 04:09 PM

No I do not work either so ', but it must be false because d3d_set_hidden funsioni its effect, thus making true does not even get the mess of textures ... look on the post that I mentioned, they 'talk of a second d3d_set_projection_orto, I did not understand but maybe you know best
( http://gmc.yoyogames...howtopic=491079 ) i use google translate... :yes:
  • 0

#15 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 31 March 2012 - 04:26 PM

No I do not work either so ', but it must be false because d3d_set_hidden funsioni its effect, thus making true does not even get the mess of textures ... look on the post that I mentioned, they 'talk of a second d3d_set_projection_orto, I did not understand but maybe you know best
( http://gmc.yoyogames...howtopic=491079 ) i use google translate... :yes:

The link is broken... and It's obvious that you're using google translate XD! Invert true and false in d3d_set_hidden in my code and try it again. If neither this works, I don't know how to help you... unless I can see the topic :(
  • 0

#16 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 31 March 2012 - 04:39 PM

ok this is working! ( http://gmc.yoyogames...howtopic=491079 ) excuse for the other link I had put no try ...thanks!!
  • 0

#17 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 01 April 2012 - 02:27 PM

ok this is working! ( http://gmc.yoyogames...howtopic=491079 ) excuse for the other link I had put no try ...thanks!!

Two ways:
1) try this code:
d3d_set_projection_ext (0, 0, 0, 0, -1, 0, 0, 0, 1, 45, <aspect>, 12, 15000);
d3d_model_draw (gunmodel, 0, 0, 0, <texture>);
Replace your variables in d3d_model_draw, and <aspect> with the ratio between the width and the height of the screen (for example, if you're using a 320x240 resolution, your <aspect> is 320/240=1,3). Don't use d3d_transform_set_identity(), d3d_transform_add_rotation and d3d_transform_add_translation or your model will be messed up.
2)try this code:
d3d_transform_set_identity()
d3d_transform_add_rotation_x(90)
d3d_transform_add_rotation_y(-obj_player.pitch +obj_player.f +obj_player.fd)
d3d_transform_add_rotation_z(obj_player.bearing -obj_player.aftermath)
d3d_transform_add_translation(obj_player.x,obj_player. y,obj_player.z);
d3d_set_hidden(false)
d3d_set_culling(true)
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player. f*2,3,obj_player.gun_h,background_get_texture(relife))
d3d_set_hidden(true)
d3d_set_culling(false)
d3d_transform_set_identity()
Hope it helps, this is as much as I can do :(
  • 0

#18 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 01 April 2012 - 04:05 PM

i'm not undertand "aspect" in d3d_set_projection_ext, is the resolution? we have to put?and for animations?

Edited by SF01, 01 April 2012 - 04:13 PM.

  • 0

#19 SOI_7

SOI_7

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 01 April 2012 - 04:39 PM

i'm not undertand "aspect" in d3d_set_projection_ext, is the resolution? we have to put?and for animations?

Yes, you have to put it, and for animations, try this:
d3d_set_projection_ext (0, 0, 0, 0, -1, 0, 0, 0, 1, 45, 1.3, 12, 15000);
d3d_model_draw(obj_player.gun,obj_player.gun_z-obj_player. f*2,3,obj_player.gun_h,background_get_texture(relife));
And what about the other code?
  • 0

#20 SF01

SF01

    GMC Member

  • New Member
  • 11 posts
  • Version:GM8

Posted 01 April 2012 - 05:27 PM

with the second work but like I said you see the weapon with the front and back confused you can't use, I'm still trying with the first ...but you've proven methods?

Edited by SF01, 01 April 2012 - 05:30 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users