3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Vec_for_vertex --- problem with temp.x
#471325
02/28/18 05:23
02/28/18 05:23
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
Hello,
I'm adding a muzzle flash model to be created when the gun fires. The flash is supposed to come from a specified vertex which I believe is in the code correctly.
Here is the code:
vec_for_vertex (temp.x, plyr_machinegun, 32);
ent_create (mflash_mgun_mdl, temp.x, muzzle_flash);
However, when I run the engine, there is this error message:
'temp' undeclared identifier < vec_for_vertex (temp.x, plyr_machinegun, 32); >
Can anyone see what is causing the problem?
June smooth-3d.com
|
|
|
Re: Vec_for_vertex --- problem with temp.x
[Re: 20BN]
#471349
02/28/18 17:15
02/28/18 17:15
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
A simple solution, thank you 20BN.
I believe temp.x worked in .wdl code but not in lite-c.
June smooth-3d.com
|
|
|
Re: Vec_for_vertex --- problem with temp.x
[Re: Superku]
#471360
03/01/18 05:43
03/01/18 05:43
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
Thank you for the tips Superku.
Do you know if its possible to use vec_for_vertex on a ent_createlayer entity?
I've been trying for many hours to figure it out.
Basically the first person weapon is created at the start of the game using ent_createlayer.
When the gun is firing the intention is to create a muzzle flash at the vertex # of the tip of the gun. For some reason it is not appearing when the gun fires (bullets are surely coming out though).
The code in the gun firing function:
VECTOR mgun_tip;
vec_for_vertex(mgun_tip, plyr_machinegun, 32);
ent_create (mgun_flash_mdl, mgun_tip, muzzle_flash);
function muzzle_flash() { set (my, PASSABLE); set (my, TRANSLUCENT); my.ambient = 100; my.roll = random(360); my.scale_x = 5.4; my.scale_y = my.scale_x; wait (-0.25); ent_remove (my); }
June smooth-3d.com
|
|
|
Re: Vec_for_vertex --- problem with temp.x
[Re: Superku]
#471364
03/01/18 08:54
03/01/18 08:54
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
Something I can't seem to figure out from the manual:
Can you use vec_for_vertex on a view entity?
June smooth-3d.com
|
|
|
Re: Vec_for_vertex --- problem with temp.x
[Re: Superku]
#471372
03/01/18 17:36
03/01/18 17:36
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
I see, the vector needs to be converted to a world position. I will play around with it, thank you Superku.
June smooth-3d.com
|
|
|
Re: Vec_for_vertex --- problem with temp.x
[Re: June]
#471391
03/02/18 17:18
03/02/18 17:18
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
Your advice worked perfectly.
June smooth-3d.com
|
|
|
|