Jump to content
Sign in to follow this  
csj

exhaust direction problem

Recommended Posts

Simply I want the exhaust smoke to blow back from the vehicles engines when started.

So if the vehicle is facing East then the exhaust smoke will blow West.

Got this code from wiki but the problem with here is the vehicles velocity is 0.

Can someone plz help me out ?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_vehicle = _this select 0

_vel = velocity _vehicle;

_dir = (direction _vehicle)-180;

_speed = 10;

velX = [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)];

drop[["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 3, 1], "", "Billboard", 1, 1.3, [-3.5,2.4,-2], velX , .1, 0.275, 0.2, 0.1, [1, 8], [[0.06, 0.06, 0.06, 0.8], [0.06, 0.06, 0.06, 0.5], [0.06, 0.06, 0.06, 0]], [0, 1], .01, 0.05, "", "", _vehicle];

Edited by W0lle

Share this post


Link to post
Share on other sites

Obviously more difficult then I thought sad_o.gif

Share this post


Link to post
Share on other sites

I would calculate velX more like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehicle = _this select 0

_speed = (speed _vehicle)/3.6;

_speed = _speed + 10;

_vecDir = vectorDir _vehicle;

_velX = [(_vecDir select 0)*(-_speed),(_vecDir select 1)*(-_speed),(_vecDir select 2)*(-_speed)];

not tested whistle.gif

Edited by W0lle

Share this post


Link to post
Share on other sites

Thanks for reply T_D

I just tested this and a couple of variations but no luck.

Much the same results as I had before.

I still think the problem is the vehicle has no velocity before you start the engine so

speed = (speed _vehicle)/3.6; speed _vehicle is still 0

The vehicle needs to be given a fictitious velocity in the direction it faces.

Edited by W0lle

Share this post


Link to post
Share on other sites

hmm but this scripts adds 10 to _speed variable, so even if speed _vehicle is 0 then _speed will be 10 and will move along the vectorDir of the vehicle. At least thats the theory.

Share this post


Link to post
Share on other sites

You've attached the particle to the vehicle. When you do that, you should not need to include the orientation of the vehicle in the velocity calculation, as the velocity vector will be relative to the vehicle's orientation already. Just like the position vector you have is relative to the vehicle's orientation.

Rather than doing a fancy calculation, just put in a single vector for the velocity like:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_velX = [0, -10, 0];That should produce smoke that goes 10m/s to the rear of the vehicle (I didn't test it, but the idea is right).

smile_o.gif

Edited by W0lle

Share this post


Link to post
Share on other sites

Canukausiuka - amazing, wright on the money notworthy.gif

Simple is always best.

Thanks Canukausiuka and T_D for helping

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×