bigpickle 0 Posted August 18, 2011 (edited) Is it possible to create an object and set its facing direction, and give it some velocity My reason for asking is on a waypoint for an A10 (_myplane) i do this small script via exc VM //null=[_myplane] execvm "GBU.sqf"; _myplane = _this select 0; _pos = position _myplane; _GBU = "Bo_Mk82" createVehicle [0, 0, 0]; _GBU attachTo [_myplane]; _GBU setpos [(_pos select 0), (_pos select 1), (_pos select 2)-2]; detach _myplane; sleep 20; My bombs spawn as i want them to but, they dont face the direction of the planes travel and the just fall without any forward velocity :( Edited August 18, 2011 by Bigpickle Share this post Link to post Share on other sites
kylania 568 Posted August 18, 2011 http://community.bistudio.com/wiki/setVelocity Share this post Link to post Share on other sites
bigpickle 0 Posted August 18, 2011 (edited) http://community.bistudio.com/wiki/setVelocity wow that was quick thanks Kylania :) ---------- Post added at 04:47 PM ---------- Previous post was at 04:26 PM ---------- //null=[_myplane] execvm "GBU.sqf"; _myplane = _this select 0; _pos = position _myplane; _GBU = "Bo_Mk82" createVehicle [0, 0, 0]; _GBU attachTo [_myplane]; _GBU setpos [(_pos select 0), (_pos select 1), (_pos select 2)-1]; _vel = velocity _myplane; _dir = direction _myplane; _speed = 10; comment "Added speed"; _GBU setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)]; detach _myplane; sleep 20; Does this appear to be doing what i'm asking? Edited August 18, 2011 by Bigpickle Share this post Link to post Share on other sites
kylania 568 Posted August 18, 2011 That should make your bomb fly 10m/s faster than your plane in the direction the plane was moving. I'm not sure if that'll translate into a "bomb falling" arc though. It might. :) I know there's been "how to fake a bomb run" scripts in the editing forums before which included the math for this, I'll poke around and try to find one. Share this post Link to post Share on other sites
bigpickle 0 Posted August 18, 2011 (edited) hmm well it fell in the wrong direction and certainly didnt appear to fly faster than the plane or in the direction it was moving. Although I can change that by having the plane always come in from South to North. Only problem there is it then needs to be real time incase the plane has to move to avoid collison. I really appreciate the help. Edited August 18, 2011 by Bigpickle Share this post Link to post Share on other sites
kylania 568 Posted August 18, 2011 Here's one example from MCC which works pretty well. Share this post Link to post Share on other sites
bigpickle 0 Posted August 21, 2011 Using my named aircraft i.e _myplane does this below appear correct as i could get it to work, no bombs fell :o //null=[_myplane] execvm "GBU.sqf"; _myplane = _this select 0; _bomb = "Bo_Mk82" createvehicle [getpos _myplane select 0,getpos _myplane select 1,3000]; _bomb setpos [getpos _myplane select 0,(getpos _myplane select 1)-4,(getpos _myplane select 2) -2]; _bomb setdir getdir _myplane; _bomb setVelocity [((velocity vehicle _myplane) select 0)/3, ((velocity vehicle _myplane) select 1)/3,-30]; _bomb2 = "Bo_Mk82" createvehicle [getpos _myplane select 0,getpos _myplane select 1,3000]; _bomb2 setpos [getpos _myplane select 0,(getpos _myplane select 1)+4,(getpos _myplane select 2) -2]; _bomb2 setdir getdir _myplane; _bomb2 setVelocity [((velocity vehicle _myplane) select 0)/3, ((velocity vehicle _myplane) select 1)/3,-30]; sleep 0.2; Share this post Link to post Share on other sites
kylania 568 Posted August 21, 2011 _myplane is a local variable, so you shouldn't really name your plane that. the trigger shouldn't have even let you type that out really. Your code works just fine though. See the demo here. Just wait for the C-130 to fly over head. Share this post Link to post Share on other sites
bigpickle 0 Posted August 22, 2011 (edited) Thank you Kylania, its working now, guess i forgot to change something somewhere maybe. You have been a great help mate. Edited August 22, 2011 by Bigpickle Share this post Link to post Share on other sites