Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (alibaba), 3,864 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Flamethrower [Re: Kartoffel] #363774
03/14/11 18:03
03/14/11 18:03
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Ok, I'll try with box thing laugh
About vec_rotate, yes I use velocity vector for particles.
I do it like this:
Quote:
VECTOR temp_pos;
temp_pos.x = 20 * time_step;
temp_pos.y = 0;
temp_pos.z = 0;
vec_set(p.vel_x,temp_pos.x);
vec_rotate(temp_pos.x,camera.pan);



Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Flamethrower [Re: 3run] #363809
03/14/11 20:01
03/14/11 20:01
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Sorry for the late answer smirk

Well i think this should work:

Code:
VECTOR temp_pos;
VECTOR particle_vel;

vec_set(temp_pos,nullvector); // this needs not that much lines :P
temp_pos.x = 20 * time_step;  //  "   "   "   "   "   "   "   "

vec_set(particle_vel,temp_pos);
vec_rotate(particle_vel,flamethrower.pan) //flamethrower= pointer to the flamethrower entity
                                          //(i think the flamethrower always has the same
                                          //angle, the particles fly)

vec_set(p.vel_x,particle_vel);

vec_rotate(temp_pos.x,camera.pan);



another thing:
you should run the code above for every particle ONCE
otherwise the particle wil change their direction if you turn the flamethrower

[EDIT]
you use:

vec_set(p.vel_x...);

this should work, but try it without setting the vars as vector.
what i mean is this:

p.vel_x = your_velocity_vector.x;
p.vel_y = your_velocity_vector.y;
p.vel_z = your_velocity_vector.z;

Last edited by Kartoffel; 03/14/11 20:06.

POTATO-MAN saves the day! - Random
Re: Flamethrower [Re: Kartoffel] #363812
03/14/11 20:19
03/14/11 20:19
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
I see the problem:

Code:
vec_set(p.vel_x,temp_pos.x);
vec_rotate(temp_pos.x,camera.pan);



first you set the velocity to the temo vector.
and then you rotate the temp vector.
the temp vector now has the right direction, but you should copy it's contents to the vel_x vector! grin

just swap these lines, and I think life gets some easier.


Check out the throwing game here: The throwing game
Re: Flamethrower [Re: Roel] #363813
03/14/11 20:24
03/14/11 20:24
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Originally Posted By: Roel
I see the problem:

Code:
vec_set(p.vel_x,temp_pos.x);
vec_rotate(temp_pos.x,camera.pan);



first you set the velocity to the temo <-(i found a mistake! xD) vector.
and then you rotate the temp vector.
the temp vector now has the right direction, but you should copy it's contents to the vel_x vector! grin

just swap these lines, and I think life gets some easier.



I saw this, too. but i thought it should be like this (it should be obvious that it wont work). so in my posted code i created a new vector.


POTATO-MAN saves the day! - Random
Re: Flamethrower [Re: Kartoffel] #363844
03/14/11 23:14
03/14/11 23:14
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Get rid of time_step -- particle movement through the vel_x vector automatically uses time_step, so it'll make things worse, even after you fix things as Roel and others pointed out.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Flamethrower [Re: JibbSmart] #364002
03/15/11 22:06
03/15/11 22:06
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Thank you all guys, but something is going wrong, please check it out:
Code:
function fade_flames(PARTICLE* p)
{
   p.alpha += 1.5 * time_step;
   p.size += 1 * time_step;
   if(p.alpha < 0){p.lifespan = 0;}
}
function flames(PARTICLE* p)
{
   VECTOR vTemp;
   vTemp.x = 50;
   vTemp.y = 0;
   vTemp.z = 0;
   vec_rotate(vTemp.x,camera.pan);
   vec_add(p.vel_x,vTemp.x); // tried with vec_set and separately too
   p.bmap = flame_tga;
   p.size = 1 + random(2);
   p.alpha = 100;
   set(p,BRIGHT|MOVE|TRANSLUCENT);
   p.event = fade_flames;
}

It looks weird, as if alpha was decresing with high speed, I tried without event, same result.
I create particles in function which I call in while loop, and I use "wait(-0.5);" for creating speed...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Flamethrower [Re: 3run] #364494
03/18/11 16:54
03/18/11 16:54
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Forgive me for all stupid questions I've asked here, solution was quit easy.
You can download flamethrower demo here:
Flamethrower thread Feel free to use it!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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