Turk Posted February 27, 2014 Report Share Posted February 27, 2014 Is there a way to stop heli lifted vehicles or player carried objects from falling thru player built floors/roof? I found this page: https://community.bistudio.com/wiki/lineIntersects but I lack the code ability to somehow convert this, if it's possible. Insight anyone? Link to comment Share on other sites More sharing options...
Shizweak Posted February 28, 2014 Report Share Posted February 28, 2014 There are a few things that would need to change, e.g: surveiller_conditions_actions_menu.sqf R3F_LOG_action_heliport_larguer_valide = (driver R3F_LOG_objet_addAction == player && !isNull (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte") && ([0,0,0] distance velocity R3F_LOG_objet_addAction < 15) && (getPos R3F_LOG_objet_addAction select 2 < 40) && !(R3F_LOG_objet_addAction getVariable "R3F_LOG_disabled")); The above checks if "dropping" is valid, with the main checks being velocity ([0,0,0] distance velocity R3F_LOG_objet_addAction < 15) and the Z distance from the ground (getPos R3F_LOG_objet_addAction select 2 < 40) . You would need to change this to search for buildings/objects near by, then calculate the bounding box and then the world position based on the height, e.g: _obj = (nearestObjects [_heli, ['Building], 40]) select 0; // find an object within 40 meters _obj_bounds = boundingBox _obj; // get the bounding box of the object _obj_height = _obj_bounds select 1; // get the height of the object _world_pos = _obj modelToWorld [0, 0, _obj_height]; // get the world position, offsetting the z index by the height _world_pos_z = _world_pos select 2; // get the z index of the world position The above essentially gives you a z position in the world space, at the top of the building (or buildable object, e.g. floor) - not sure if the epoch buildables are a subclass of 'Building' or any of its children - but IIRC it is. Then, inside larguer.sqf detach _objet; _objet setPos [getPos _objet select 0, getPos _objet select 1, 0]; _objet setVelocity [0, 0, 0]; This sets the object position, to its current X/Y, but zero Z (the ground) - essentially you would change this to: detach _objet; _objet setPos [getPos _objet select 0, getPos _objet select 1, _world_pos_z]; _objet setVelocity [0, 0, 0]; Keep in mind, this is all of the top of my head, I haven't tested this - I see a few issues with it, for example, it having trouble figuring out whether to drop on the ground or on top of an object - you would have to determine which is closer. Otherwise, you could add another action menu "Drop the object on closest building" which would give the pilot the choice (maybe a smarter option). Another issue will be nearestObjects, as it will be searching in all planes (x, y, z) AFAIK, so you may need to filter out objects that are too far away on x/y planes - although I would hazard to guess this may not be a major problem as the first object in result SHOULD be the closest. EDIT: actually nearestObjects would certainly cause a problem if you were hovering between a few buildings, I'll have a play around this evening and see what I can come up with - I've wanted to do this for a while anyway (e.g. put GPK on towers at castle) Link to comment Share on other sites More sharing options...
Turk Posted February 28, 2014 Author Report Share Posted February 28, 2014 excellent,... let me know what you come up with. Link to comment Share on other sites More sharing options...
Shizweak Posted February 28, 2014 Report Share Posted February 28, 2014 Couldn't get it to work how I wanted, ended up just doing the following: surveiller_conditions_actions_menu.sqf (remove distance check) R3F_LOG_action_heliport_larguer_valide = (driver R3F_LOG_objet_addAction == player && !isNull (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte") && ([0,0,0] distance velocity R3F_LOG_objet_addAction < 15) && !(R3F_LOG_objet_addAction getVariable "R3F_LOG_disabled")); Link to comment Share on other sites More sharing options...
Turk Posted February 28, 2014 Author Report Share Posted February 28, 2014 Ok,.. I'll try that out,... see how it does. Will those changes do the same thing for objects carried by player? Thanks for the attempt Link to comment Share on other sites More sharing options...
Turk Posted February 28, 2014 Author Report Share Posted February 28, 2014 Tried it out,.. working like a champ for the Heli lift objects,... thanks! Link to comment Share on other sites More sharing options...
Deepsniper Posted February 28, 2014 Report Share Posted February 28, 2014 You might be able to just remove the last part of the set pos and leave the rest. That would allow you to place a vehicle and it might land where you put it. Can you guys test that out for me? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now