davidoss 552 Posted October 31, 2016 Hi. I am trying to set an fly effect for object that was blew up by pipe bomb. How i can do that? Share this post Link to post Share on other sites
riten 153 Posted October 31, 2016 You could use setvelocity - https://community.bistudio.com/wiki/setVelocity Share this post Link to post Share on other sites
davidoss 552 Posted October 31, 2016 I'd also have look at setVelocity but i need an example because i do not knew how to organize this. Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted October 31, 2016 What's there to know? You have an explosion, you have setVelocity, work your way from there. Cheers Share this post Link to post Share on other sites
davidoss 552 Posted October 31, 2016 private _bomb = createVehicle ["Bo_Mk82",[getPos _vehicle select 0, getPos _vehicle select 1,0],[], 0, 'FLY']; null = [_bomb,-90,0] call BIS_fnc_setPitchBank; _bomb setVelocity [0, 0, -80]; _vel = velocity _vehicle; //[0,0,0] _dir = direction _vehicle; //139.82 _speed = 500; _vehicle setVelocity [ (_vel select 0) + (sin _dir * _speed), //322.595 (_vel select 1) + (cos _dir * _speed), //-382.011 (_vel select 2)//0 ]; _vehicle setDamage 1; not working, object stays as destroyed where it was. Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted October 31, 2016 Try adding some positive vertical velocity. Cheers Share this post Link to post Share on other sites
johnnyboy 3803 Posted October 31, 2016 What is the object you want to fly? Some objects don't have physics, so you need to attach an object that is affected by physics. Also dead objects also don't have physics. My burning barrel script was broken by an Arma patch that removed physics from dead objects, so barrels would no longer fly. My fix was to create a new small object with physics, attach the barrel to it, and use setVelocity on the physics object. This is how I made barrels fly, fish jump, etc. Example: // Eden Editor patch broke physics working on dead objects, so barrels freeze in air. So adding physics object for launching barrels. _physicsObj = "Land_Can_V3_F" createVehicle [10,10000,0]; _physicsObj allowdamage false; // prevents object from freezing mid-air when damage = 1 _physicsObj disableCollisionWith _obj; _origMass = getmass _physicsObj; _physicsObj setMass getmass _obj; _physicsObj setpos (_obj modelToWorld [0,0,0]); _obj enableSimulation false; _obj attachTo [_physicsObj, [0,0,0]]; [_physicsObj, 0,random 90] call BIS_fnc_setPitchBank; waitUntil {!(isNull attachedTo _obj) }; _physicsObj setVelocity [_speed * sin(random 360), _speed * cos(random 360), _zvel]; Another trick to get objects to fly further is to reduce their mass value with setMass command. Share this post Link to post Share on other sites
davidoss 552 Posted October 31, 2016 It is a Device (Assembled) "Land_Device_assembled_F". Share this post Link to post Share on other sites
johnnyboy 3803 Posted October 31, 2016 Adapt my code example to attach your vehicle to the physics object, and I guarantee you the Device will fly brother! Share this post Link to post Share on other sites
davidoss 552 Posted October 31, 2016 Well it didn't. if (isServer) then { this addEventHandler ["Explosion",{ params ["_vehicle","_addeddamage"]; private _position = getPos _vehicle; private _dammage = damage _vehicle; if (_addeddamage > 0 && _dammage > 0 && _dammage < 1) then { // prevent multiple execution private _bomb = createVehicle ["Bo_Mk82", _position,[], 0, 'FLY']; null = [_bomb,-90,0] call BIS_fnc_setPitchBank; _bomb setVelocity [0, 0, -80]; private _speed = 100; private _physicsObj = "Land_Can_V3_F" createVehicle [10,10000,0]; _physicsObj allowdamage false; _physicsObj disableCollisionWith _vehicle; _physicsObj setMass (getmass _vehicle); _physicsObj setpos (_vehicle modelToWorld [0,0,0]); _vehicle enableSimulation false; _vehicle attachTo [_physicsObj, [0,0,0]]; null = [_physicsObj, 0,random 90] call BIS_fnc_setPitchBank; waitUntil {!(isNull attachedTo _vehicle) }; _physicsObj setVelocity [_speed * sin(random 360), _speed * cos(random 360), 100]; _vehicle setDamage 1; }; }]; }; VIDEO @edit Its works if the pipe bomb is not destroying the object directly. The if statement are wrong i think. VIDEO The device are somewhere in universe :-) Is there any possibility to slow down the effect? Make it not so aggressive that the object falls nearby? Share this post Link to post Share on other sites
johnnyboy 3803 Posted October 31, 2016 Well, as our Grumpy Old Friend said, we need a positive Z value in setVelocity. I just created a sample mission in the editor with a player and a device named "device1". I then executed the following code from the debug console, and the device flys. nul= [device1] spawn { params["_vehicle"]; private _speed = 100; private _physicsObj = "Land_Can_V3_F" createVehicle [10,10000,0]; _physicsObj allowdamage false; _physicsObj disableCollisionWith _vehicle; _physicsObj setMass (getmass _vehicle); _physicsObj setpos (_vehicle modelToWorld [0,0,0]); _vehicle enableSimulation false; _vehicle attachTo [_physicsObj, [0,0,0]]; null = [_physicsObj, 0,random 90] call BIS_fnc_setPitchBank; waitUntil {!(isNull attachedTo _vehicle) }; private _bomb = createVehicle ["Bo_Mk82", getpos _vehicle,[], 0, 'FLY']; null = [_bomb,-90,0] call BIS_fnc_setPitchBank; _bomb setVelocity [0, 0, -80]; _physicsObj setVelocity [_speed * sin(random 360), _speed * cos(random 360), 20]; _vehicle setDamage 1; }; Notice the Z velocity is 20 in the code above. Share this post Link to post Share on other sites
killzone_kid 1333 Posted October 31, 2016 My burning barrel script was broken by an Arma patch that removed physics from dead objects, so barrels would no longer fly. Don't let them die 3 Share this post Link to post Share on other sites