Harzach 2510 Posted June 28, 2017 Howdy-doo, I am trying to spawn a circular "arena" wall, with some success. The problem I am having is this: *pic removed - eff you, Photobucket!* I have tried every permutation of setDir/setPos/SetVectorUp after creating each segment of wall that I can think of, but the result is always the same. They never quite line up. Here is the current (and most complicated) code I am using to debug: Spoiler for "_i" from 0 to 119 do { _ix = (_i * 3); _yaw = (270 - _ix); _roll = 0; _pitch = 0; _dirx = sin(_yaw) * cos(_roll); _diry = cos(_yaw) * cos(_roll); _dirz = sin(_roll); _upx = cos(_yaw) * cos(_roll) * sin(_pitch); _upy = sin(_yaw) * cos(_roll) * sin(_pitch); _upz = cos(_roll) * cos(_pitch); _x = round(100 * cos _ix); _y = round(100 * sin _ix); _obj = createVehicle ["Land_PillboxWall_01_6m_F",[0,0,0],[],0,"CAN_COLLIDE"]; _obj setVectorDirAndUp [[_dirx,_diry,_dirz],[_upx,_upy,_upz]]; _obj setPosATL [(getPos player select 0) + _x,(getPos player select 1) + _y,0]; }; Again, I have tried every variation of setPos/setDir/setVectorUp that I can think of, so I am at a loss. What am I missing? Or is this just how it is? I could swear I was able to accomplish cleaner results in A2. Share this post Link to post Share on other sites
sarogahtyp 1106 Posted June 28, 2017 you could try these rotation tensor script: use the first script to build a rotation tensor for ur desired x,y and z rotation. the second script is used to apply the tensor to your vector. if the rotation is always the same then u just have to use the first script one single time and just use the second script to apply the same rotation tensor again and again. there is another solution posted by larrow in this thread. Maybe this could be faster... just try! 1 Share this post Link to post Share on other sites
killzone_kid 1326 Posted June 28, 2017 47 minutes ago, Harzach said: _x = round(100 * cos _ix); _y = round(100 * sin _ix); What exactly do you think round does? 2 Share this post Link to post Share on other sites
Harzach 2510 Posted June 28, 2017 23 minutes ago, sarogahtyp said: you could try these rotation tensor script: use the first script to build a rotation tensor for ur desired x,y and z rotation. the second script is used to apply the tensor to your vector. if the rotation is always the same then u just have to use the first script one single time and just use the second script to apply the same rotation tensor again and again. there is another solution posted by larrow in this thread. Maybe this could be faster... just try! Thank you, I will take a look! Still, I am curious as to why these objects are not spawning "correctly" in the first place. Share this post Link to post Share on other sites
Harzach 2510 Posted June 28, 2017 4 minutes ago, killzone_kid said: What exactly do you think round does? 4 minutes ago, Harzach said: Still, I am curious as to why these objects are not spawning "correctly" in the first place. Succinct as ever, KK. Thank you! *edit* - As expected, working perfectly now. What a forehead slapper! Share this post Link to post Share on other sites
Guest Posted June 28, 2017 Amazing! Glad the problem was solved. Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted June 28, 2017 word of advice and experience ... spawn all your vehicles off-site, in the corner of the map or something. then use setPos/setVehiclePosition/etc to put it where you want it. Spawning your object at the location can present all sorts of unexpected issues. 2 Share this post Link to post Share on other sites
sarogahtyp 1106 Posted June 28, 2017 4 minutes ago, fn_Quiksilver said: word of advice and experience ... spawn all your vehicles off-site, in the corner of the map or something. then use setPos/setVehiclePosition/etc to put it where you want it. Spawning your object at the location can present all sorts of unexpected issues. but take care to don't spawn vehicles in water because it's engine will get damaged and can't be started anymore. Just my personal expierience with spawning at [0,0,0] 2 Share this post Link to post Share on other sites
Harzach 2510 Posted June 28, 2017 3 minutes ago, fn_Quiksilver said: word of advice and experience ... spawn all your vehicles off-site, in the corner of the map or something. then use setPos/setVehiclePosition/etc to put it where you want it. Spawning your object at the location can present all sorts of unexpected issues. Yup, learned that one early on, and it's what I'm doing here (spawning at [0,0,0]). My error was blindly using a code snippet from other work without actually thinking about the specifics of what it was doing. Fortunately, hacks like me can rely on the scripting heroes of this forum to give us a shove in the right direction. Share this post Link to post Share on other sites
Guest Posted June 28, 2017 7 hours ago, sarogahtyp said: but take care to don't spawn vehicles in water because it's engine will get damaged and can't be started anymore. Just my personal expierience with spawning at [0,0,0] sarogahtyp, I had this problem, but the vehicle just don't work on the machine that spawned it, other players was able to drive the vehicle. Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted June 29, 2017 no need to use 0,0,0 ... Assuming it will be there for a few frames max, I generally do something like this: createVehicle [<type>,[(random -1000),(random -1000),(1000 + (random 1000))],[],0,'NONE']; Share this post Link to post Share on other sites
killzone_kid 1326 Posted June 29, 2017 1 hour ago, fn_Quiksilver said: I generally do something like this This just adds 3 commands and 3 arithmetic operations to the load for no reason. The createVehicle command has random radius param if you want that random placement. 1 Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted June 29, 2017 5 hours ago, killzone_kid said: This just adds 3 commands and 3 arithmetic operations to the load for no reason. The createVehicle command has random radius param if you want that random placement. eh, it works :) i would say worrying about using the + operator is classed as nitpicking. Share this post Link to post Share on other sites
killzone_kid 1326 Posted June 29, 2017 4 minutes ago, fn_Quiksilver said: i would say worrying about using the + operator is classed as nitpicking. You think? [1,2,3] - 0.0012ms [1+1,2+2,3+3] - 0.0031ms + is a command, random is a command. You are adding 6 extra commands for no reason. Nitpicking? I call this waste. Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted June 29, 2017 3 minutes ago, killzone_kid said: You think? [1,2,3] - 0.0012ms [1+1,2+2,3+3] - 0.0031ms + is a command, random is a command. You are adding 6 extra commands for no reason. Nitpicking? I call this waste. that example is fake news. the goal of the 'random' is to put the vehicle in a random position, the top one (with the lower ms) is not doing this, functionally useless also i am assuming you know how much waste and useless ms is spent engine-side and in BI scriptland, that a modder should not be wasting his precious time fretting over 0.000ths of a millisecond Share this post Link to post Share on other sites
killzone_kid 1326 Posted June 29, 2017 6 minutes ago, fn_Quiksilver said: that example is fake news You drunk? 6 extra commands vs changing 0 to 100 in command param? Also you seem to underestimate how quickly time can add up. Share this post Link to post Share on other sites
Harzach 2510 Posted June 29, 2017 IMO, efficiency/economy is always the better choice. Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted June 29, 2017 29 minutes ago, Harzach said: IMO, efficiency/economy is always the better choice. one resource many designers overlook is their own time ... during design, always consider your time/economy, not just cpu ms :) Share this post Link to post Share on other sites