Kommiekat 11 Posted September 29, 2013 Lots of mountains and hill on these maps. Some Coves are located will little flat area, therefore, need to use the slopes coming in, for example what you see at Jay Cove on Stratis. When placing H-Barriers or Razor Wire on a slope away from the road that ends at the Coves, cannot get the objects to align with the sloped ground surface. Tried SetPos and GetPos to no avail. Any ideas on how to tilt it parallel to the ground surface? Even is the object has to stick a little underground is OK. I can upload a pic for more clarification if needed. Share this post Link to post Share on other sites
mantls 2 Posted September 29, 2013 try: [this] execVM "surfaceNormal.sqf" _obj = _this select 0; _normal = surfaceNormal _obj; _obj setVectorUp _normal; you can probably insert that into the fences init line aswell, not sure though. But surfaceNormal and setVectorUp should do the Trick. Share this post Link to post Share on other sites
Kommiekat 11 Posted October 3, 2013 Thanks guys! @mantls Tried your script and worked like a charm! I just wish there was a way to achieve these great things for easy search and use.........thx! Share this post Link to post Share on other sites
surfer 42 Posted October 3, 2013 Can't wait to try this! Thanks mantls! Share this post Link to post Share on other sites
Kommiekat 11 Posted October 5, 2013 One thing I've realized, it doesn't seem to work with RAZOR-WIRE. Share this post Link to post Share on other sites
mantls 2 Posted October 5, 2013 Razorwire is a B*tch. it does work...somewhat, yet it still looks weird and you'll prbly have to lower the Wires Position a little bit into the Ground to let it look less fucked up. Share this post Link to post Share on other sites
Kommiekat 11 Posted October 6, 2013 @mantls, Hey guy, your script works like a charm, especially with H-Barriers. I don't need the Razor-Wire anyways. Just wanted to let you know, I use the "Show Script Errors" while editing and I get a reference to you scrip for line #2: _normal = surfaceNormal _obj; I was wondering, is it because the objects need to be named as well? As in _normal? I didn't name them. That would be a lot of work, especially if you were to make templates. It's not a game breaker or anything and players should not be using show script errors during play through anyways. Cheers! Share this post Link to post Share on other sites
mantls 2 Posted October 6, 2013 hm? the object should be passed through the Parameter. _obj = _this select 0; Share this post Link to post Share on other sites
blackmamb 2 Posted October 6, 2013 surfaceNormal expects a position iirc. It should be _obj setVectorUp (surfacenormal (getPosATL _obj)); Or from the editor init line: this setVectorUp (surfacenormal (getPosATL this)); Note that surfacenormal will only take into account the two first parameters of the position, so getPos could also work, but getPosATL is way faster. Share this post Link to post Share on other sites
mantls 2 Posted October 6, 2013 you are right! surfaceNormal Kinda forgot that. Share this post Link to post Share on other sites
Kommiekat 11 Posted October 6, 2013 this setVectorUp (surfacenormal (getPosATL this)); OK, I've tested your code directly into the init of Razor-Wire. As you can see, you're getting real close. Got it parallel with the surface, but not quite touching. I used mantle's and BlackMamb in a script, seperately of course, and both worked for H-Barriers, but not for Razor wire..... Both scripts had Razor-wire touching surface at one end and slanted sky-ward at about 30/40 degrees.... Seems a code in the unit itself improves things a lot......... Share this post Link to post Share on other sites
mantls 2 Posted October 6, 2013 hm, what about. //Previous Code.... _posASL = getPosASL _obj; _obj setPosASL [posASL select 0,posASL select 1, ((posASL select 2) - 2)]; // Might need to tweak that Z-Value Might need to tweak that Z-Value, but try that Share this post Link to post Share on other sites
Kommiekat 11 Posted October 6, 2013 Sorry to ask this but, where is the Z value to be changed? And what do you recommend from looking at the pics in post #12. Share this post Link to post Share on other sites
mantls 2 Posted October 6, 2013 (edited) by Z-Value i'm referring to the 3rd (select 2) element in the postionArray which is returned by getPosASL. I'd recommend you get the Height of the Object (Z-Value) above Sea level (getPosASL) and then set that height to something lower (original height - 2 metres e.g.). This way the object stays aligned with the surface but it's height should be lower (might be a bit too low and sink into the ground but you can fix that by changing the - 2). cheers. so complete Code would be: surfaceNormal.sqf _obj = _this select 0; // the object that gets aligned _offset = _this select 1; // how many metres the object gets raised/lowered. _obj setVectorUp (surfacenormal (getPosATL _obj)); // align the Object with its surface. _posASL = getPosASL _obj; // get its position ASL _obj setPosASL [posASL select 0,posASL select 1, ((posASL select 2) + _offset)]; // lower it with the given offset (_this select 1) objects init line: null = [this,NUMBER] execVM "surfaceNormal.sqf"; Negative Numbers for lowering the object. Positive Numbers for raising the object. 0 for no change. Edited October 6, 2013 by mantls Share this post Link to post Share on other sites
blackmamb 2 Posted October 6, 2013 Also remember that in A3, you can directly set the elevation from the editor. If you're placing those in the editor. Share this post Link to post Share on other sites
Kommiekat 11 Posted October 6, 2013 Thanks for your help. I think I'll hold off on the Razor Wire until I need it. That stuff is Razor difficult to align properly. I hope someone will take the time to play with your code. Seems flawless for H-Barriers as I've mentioned before. Share this post Link to post Share on other sites