csj 0 Posted March 23, 2009 (edited) 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 April 11, 2009 by W0lle Share this post Link to post Share on other sites
csj 0 Posted April 2, 2009 Obviously more difficult then I thought Share this post Link to post Share on other sites
t_d 47 Posted April 2, 2009 (edited) 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 Edited April 11, 2009 by W0lle Share this post Link to post Share on other sites
csj 0 Posted April 2, 2009 (edited) 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 April 11, 2009 by W0lle Share this post Link to post Share on other sites
t_d 47 Posted April 2, 2009 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
canukausiuka 1 Posted April 2, 2009 (edited) 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). Edited April 11, 2009 by W0lle Share this post Link to post Share on other sites
csj 0 Posted April 2, 2009 Canukausiuka - amazing, wright on the money Simple is always best. Thanks Canukausiuka and T_D for helping Share this post Link to post Share on other sites