Jump to content
Sign in to follow this  
Guest

Wall modifier script

Recommended Posts

Guest

Edit - current version broken, final version to be released soon

Hey

Because Im extremely impatient, and have to always do what Im working on 'Now' and not wait...

1

2

3

Until mapfact releases their 3d editor that comes with a wall placement system, heres something I spent a a good few hours coming up with.

It does work, saves tons of time fixing walls, and it also not uber efficient, and requires writing down the position gained in game of wall pieces.

Implement the sqm and scripts into a folder in your username missions under documents, and then make a wall in the editor of whatever type. I suggest just copy and paste this into each walls init code to start : this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]

Notice I have dropped the hegiht a bit, to basically keep the wall in the ground once final modifications have been done, and keeps them all at the same height, for overall simplicity. The vector setting forces all the wall peices to no longer 'funk' out due to the terrain (which is normally really bad), so at least everything lines up nice and strait across, although still ugly.

Then run it, walk up close to the center of each wall, select via radio 'select object' and then you can play with the other radio commands. Normally, what is needed is just changing vector and Z value. Note that each time you select radio Alpha, 'select new object', it will pickup closest 'static' object near player, so if there is static junk nearby, just stand next to the center of the wall piece...

Once yer done, hit radio Juliet, to display the settings gained. Then you can use the gained info to put into the walls init field, for both setPos and SetVectorUp. So you would modify the init code : this setPos [XNumber Gained,YNumber Gained,ZNumber gained];this setVectorUp [NewNumberGained,0,1] - Note for setVector just put in the first new number gained, the rest should remain the same, or so close it wont matter. Dont miss the "-" negative signs, like I did and had to retest 5 times to see wat the hell was going on tounge2.gif

Proffered method, once u see how it works :

Make one full stretch of ur wall, each piece having the above init code, run the mission, just get all the wall pieces the way u want them first. Then go back, with pen and paper, and write down the x,y,z settings and the VectorUp first element number for each piece, (I just number each wall piece on paper starting from the end out) and then put it in each pieces inti field.

Still takes time, but its wayy faster than trying to do it manually between the editor and in game for each wall, guaranteed. And the wall can look dang good too.

Of course, I suspect mapfacts 3d editor will provide the same function, but allow it to be saved directly to an sqf file, but I am too impatient tounge2.gif

Lastly :

I am not a programmer, and could not find the means to neither save the new coordinates for the wall pieces to a new file, nor a way to at least copy and paste them, hence it is pen and paper work. Please, if you know of a way to get the new positional code gained from the mission into a new sqf/sqs or a way to just copy and paste the code at least, feel free to modify -

This is the best I can do with my abilities thru the scripting commands provided by arma smile_o.gif

Important :

Lowflys EU is required for the test mission

LowFlys EU

In the Test mission :

I put in a wall that has like 100 pieces of wall connected. I then took the first five pieces, modified them quickly to get them looking good, wrote down their positions gained from the wallModifier script, and then put in the new positional information gained into those first 5 walls inits, and they now look about 5 times better, without jutting up alover the place due to minor terrain differences.

WallModifier.sara

mission.sqm

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

version=11;

class Mission

{

addOns[]=

{

"cacharacters",

"sara",

"EditorUpdate_v102"

};

addOnsAuto[]=

{

"cacharacters",

"EditorUpdate_v102",

"sara"

};

randomSeed=166403;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=12;

minute=0;

};

class Groups

{

items=1;

class Item0

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={14335.101563,55.649055,9428.313477};

azimut=181.563904;

id=0;

side="EAST";

vehicle="SoldierESaboteurMarksman";

player="PLAYER COMMANDER";

leader=1;

skill=0.600000;

};

};

};

};

class Vehicles

{

items=19;

class Item0

{

position[]={14364.815430,56.427143,9420.527344};

id=1;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item1

{

position[]={14370.791016,57.770538,9420.509766};

id=2;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item2

{

position[]={14376.855469,57.463036,9420.523438};

id=3;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item3

{

position[]={14382.606445,57.541782,9420.501953};

id=4;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item4

{

position[]={14388.670898,57.778248,9420.515625};

id=5;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item5

{

position[]={14394.646484,57.918953,9420.498047};

id=6;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item6

{

position[]={14400.710938,58.137520,9420.511719};

id=7;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item7

{

position[]={14406.620117,56.799328,9420.521484};

id=8;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item8

{

position[]={14412.684570,57.154484,9420.535156};

id=9;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item9

{

position[]={14418.660156,57.713596,9420.517578};

id=10;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item10

{

position[]={14424.724609,58.203251,9420.531250};

id=11;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item11

{

position[]={14430.655273,58.624790,9420.563477};

id=12;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item12

{

position[]={14436.719727,58.770443,9420.577148};

id=13;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item13

{

position[]={14442.695313,59.102661,9420.559570};

id=14;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) - .3];this setVectorUp [0, 0, 1]";

};

class Item14

{

position[]={14334.912109,55.796776,9420.451172};

id=15;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [14334.7,9420.69,-0.2279];this setVectorUp [-.039, 0, 1]";

};

class Item15

{

position[]={14340.976563,56.129753,9420.464844};

id=16;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [14340.7,9420.71,-0.2937];this setVectorUp [-0.0299, 0, 1]";

};

class Item16

{

position[]={14346.952148,56.278000,9420.447266};

id=17;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [14346.7,9420.69,-0.3920];this setVectorUp [-0.0199, 0, 1]";

};

class Item17

{

position[]={14353.016602,56.427822,9420.460938};

id=18;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [14352.8,9420.7,-0.4920];this setVectorUp [0, 0, 1]";

};

class Item18

{

position[]={14358.925781,56.573883,9420.470703};

id=19;

side="EMPTY";

vehicle="AAHO393";

skill=0.600000;

init="this setPos [14358.7,9420.71,-0.5948];this setVectorUp [0, 0, 1]";

};

};

class Sensors

{

items=10;

class Item0

{

position[]={13238.791992,12.767517,10242.719727};

a=0.000000;

b=0.000000;

activationBy="ALPHA";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Select object";

expActiv="PickObject = 1";

class Effects

{

};

};

class Item1

{

position[]={13241.782227,12.791994,10224.776367};

a=0.000000;

b=0.000000;

activationBy="BRAVO";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Add to X";

expActiv="AddToX = 1";

class Effects

{

};

};

class Item2

{

position[]={13241.782227,12.851852,10205.333008};

a=0.000000;

b=0.000000;

activationBy="CHARLIE";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Subtract from X";

expActiv="SubtractFromX = 1";

class Effects

{

};

};

class Item3

{

position[]={13242.904297,12.913418,10182.527344};

a=0.000000;

b=0.000000;

activationBy="DELTA";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Add to Y";

expActiv="AddToY = 1";

class Effects

{

};

};

class Item4

{

position[]={13244.399414,12.874467,10160.095703};

a=0.000000;

b=0.000000;

activationBy="ECHO";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Subtract from Y";

expActiv="SubtractFromY = 1";

class Effects

{

};

};

class Item5

{

position[]={13245.147461,12.728522,10141.401367};

a=0.000000;

b=0.000000;

activationBy="FOXTROT";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Add to Z";

expActiv="AddToZ = 1";

class Effects

{

};

};

class Item6

{

position[]={13245.147461,12.705937,10124.578125};

a=0.000000;

b=0.000000;

activationBy="GOLF";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Subract from Z";

expActiv="SubtractFromZ = 1";

class Effects

{

};

};

class Item7

{

position[]={13246.642578,12.685660,10108.500977};

a=0.000000;

b=0.000000;

activationBy="HOTEL";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Add to VectorUp";

expActiv="AddToVector = 1";

class Effects

{

};

};

class Item8

{

position[]={13248.885742,12.796719,10089.806641};

a=0.000000;

b=0.000000;

activationBy="INDIA";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Subtract from VectorUp";

expActiv="SubtractFromVector = 1";

class Effects

{

};

};

class Item9

{

position[]={13251.502930,13.007475,10070.831055};

a=0.000000;

b=0.000000;

activationBy="JULIET";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="Display Object Position";

expActiv="DisplayPosition = 1";

class Effects

{

};

};

};

};

class Intro

{

addOns[]=

{

"sara"

};

addOnsAuto[]=

{

"sara"

};

randomSeed=11951107;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

};

class OutroWin

{

addOns[]=

{

"sara"

};

addOnsAuto[]=

{

"sara"

};

randomSeed=15995907;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

};

class OutroLoose

{

addOns[]=

{

"sara"

};

addOnsAuto[]=

{

"sara"

};

randomSeed=12250627;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

};

Init.Sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;global switches that tell main script to execute an action

AddToX = 0

SubtractFromX = 0

AddToY = 0

SubtractFromY = 0

AddToZ = 0

SubtractFromZ = 0

AddToVector = 0

SubtractFromVector = 0

PickObject = 0

DisplayPosition = 0

[] exec "WallModifierMan.sqs"

Exit

WallModifierMan.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_CurrentObject = player

_TempPos = [0,0,0]

_StoredVectorUp = [0,0,1]

#loop

? PickObject > 0:PickObject = 0;_CurrentObject = position player nearestObject "Static";_TempPos = getPos _CurrentObject

? AddToX > 0 :AddToX = 0;_StoredVectorUp = vectorUp _CurrentObject;_TempPos set [0,( _TempPos select 0) + .1];_CurrentObject setPos _TempPos;_CurrentObject setVectorUp _StoredVectorUp

? SubtractFromX > 0 :SubtractFromX = 0;_StoredVectorUp = vectorUp _CurrentObject;_TempPos set [0,( _TempPos select 0) - .1];_CurrentObject setPos _TempPos;_CurrentObject setVectorUp _StoredVectorUp

? AddToY > 0 :AddToY = 0;_StoredVectorUp = vectorUp _CurrentObject;_TempPos set [1,( _TempPos select 1) + .1];_CurrentObject setPos _TempPos;_CurrentObject setVectorUp _StoredVectorUp

? SubtractFromY > 0 :SubtractFromY = 0;_StoredVectorUp = vectorUp _CurrentObject;_TempPos set [1,( _TempPos select 1) - .1];_CurrentObject setPos _TempPos;_CurrentObject setVectorUp _StoredVectorUp

? AddToZ > 0 :AddToZ = 0;_StoredVectorUp = vectorUp _CurrentObject;_TempPos set [2,( _TempPos select 2) + .1];_CurrentObject setPos _TempPos;_CurrentObject setVectorUp _StoredVectorUp

? SubtractFromZ > 0 :SubtractFromZ = 0;_StoredVectorUp = vectorUp _CurrentObject;_TempPos set [2,( _TempPos select 2) - .1];_CurrentObject setPos _TempPos;_CurrentObject setVectorUp _StoredVectorUp

? AddToVector > 0 :AddToVector = 0;_CurrentObject setVectorUp [(vectorUp _CurrentObject select 0) + .01,vectorUp _CurrentObject select 1,vectorUp _CurrentObject select 2]

? SubtractFromVector > 0:SubtractFromVector = 0;_CurrentObject setVectorUp [(vectorUp _CurrentObject select 0) - .01,vectorUp _CurrentObject select 1,vectorUp _CurrentObject select 2]

? DisplayPosition > 0:DisplayPosition = 0;player sidechat format ["object xyz position = %1",getPos _CurrentObject];player globalchat format ["object vectorUp position = %1",vectorUp _CurrentObject]

goto "loop"

Edit - current version broken, final version to be released soon

Share this post


Link to post
Share on other sites
Guest

Hey again

I could use any help from you guys here smile_o.gif

I am trying to figure out a way to create a dialog that displays current selected objects position coordinates, and VectorUp coords, where player can copy and paste the numbers to text for putting directly into objects inits (most doable) - this was done by CSL in his Particle Modifier system

I dont know much about dialogs, but it seems you can copy and paste from them, which would be perfect here..

Any help appreciated smile_o.gif This would really simplify things..

help.gif

Share this post


Link to post
Share on other sites

Instead of a dialog, try calling something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Localize Format ["Pos: %1 Vec: %2",getPos Player,VectorUp Player]

That will write the values to Arma.rpt. From there you can cut and paste.

Share this post


Link to post
Share on other sites
Guest
Instead of a dialog, try calling something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Localize Format ["Pos: %1 Vec: %2",getPos Player,VectorUp Player]

That will write the values to Arma.rpt. From there you can cut and paste.

Thanks smile_o.gif

I will try this m8. If it works this will be awesome

Although I do not know where to find Arma.rpt, but I can search around to find out where it is.

Share this post


Link to post
Share on other sites
Guest

Found the file, after realizing it was hidden smile_o.gif

Try this out and see what happens smile_o.gif

Share this post


Link to post
Share on other sites
Guest

It shows as an error in the .rpt, but it really doesent matter, it shows to be copied and pasted smile_o.gif

New line that shows in .rpt now from running the mission :

String this setPos [14334.6,9420.79,-0.221012];this setVectorUp [-0.0389704,0,0.99924] not found

but its perfect, only need copy and paste this direct from the .rpt to the inits! smile_o.gif

Thanks for the help UNN, this just made this all worthwhile smile_o.gif

Edit/-

Thanks Q for the link, I see now, pretty clever way of getting info from the mission in there, by purposely creating an error.

Want to test a bit more here, and then I can revise the description with the new code.

This is pretty frikkin sweet! Now you can make a 300 long stretch of wall, then just go thru and hit a radio button for each piece, copy and paste the code directly from the .rpt to the inits, and thats it. yay.gif

Cheers smile_o.gif

Share this post


Link to post
Share on other sites
Guest

There is direction setting missing in the system here, never noticed it because Ive been working off of the default facing of the walls I placed for test.

Also, a final version will be release (hopefully soon) that will do the following :

All movement changes will be selectable thru the action menu, for much quicker and easier use in game

Movement changes will now include everything, directional facing, rotation 'left/right' and forward back of objects (both are vectorUp functions)

Fix that will now store and give direction of object

All information will be stored in Arma.Rpt log script, and it will be inputted to where merely directly copying and pasting to an objects init field will be all that is needed, no modifying of it.

The test mission will not require any addons

The entire function, including test mission will be put up on rapid share.

Description will be uber simplified, as the process has now been simplified.

Credit is given to UNN for providing the code needed to get the information stored for each item in the Arma.rpt smile_o.gif

A new, final release thread will be started. This will take some time, hopefully it gets done today smile_o.gif

Share this post


Link to post
Share on other sites
Guest

I have found a bug I just cant get rid of without huge efforts.

It seems various objects, especially walls and fences, do *not* go exactly to their current position when a 'setPos GetPos' is used. They always jump a few feet over. Ive tried many angles on how to fix this, it just wont.

The only way I can find to fix it is not really worth it, to use objects that *do* move to their exact position when the call is given, and then use walls to follow their movement for each piece.. a much more complicated system, also making usage more complicated too.

it is *very* weird tho, and seems numerous objects have 2 different positions that are used for setPos and GetPos. I have tested this, took 2 walls next to eachother, took one wall and setPos'ed it at the 'getPos' of the other wall, guess what.. it teleported to the other wall, but about 3 feet offset. Teleport a wall to its own pos, same thing, it jumps over like 3 feet. And this makes it hard, the only way to modify x,y,z coords is to Object setpos getpos Object, hence it 'jumps' over on the command, knocking the piece way out of the wall stretch. I have at least kept this problem to only the first x,y,z move for a selected object, as I can store its initial x,y,z position and hold it, only adding what changes are made to the stored value and moving the walls this way, but the initial stored location is still offset, hence the first x,y,z movement change knocks it out of position. For a release, its not good enough to want to pick a wall piece, select it, want to move it over a little to the right/left/forward/back, and the first thing it does is jumps way out of line...

The fix using another object mixed in would really take the thing to a new level of time consumption and increase both complexity of implementation and usage..

Sorry, thought I had it all worked out, but alas, Arma just threw in a final punch on this system, which is not the first time Ive dropped a script system due to problems in Arma confused_o.gif

Ah well, thanks for the help, it was fun smile_o.gif

Share this post


Link to post
Share on other sites

You can take modelToWorld [0,0,0] to get its real center. Then get the difference between pos and modelToWorld and add it to pos. When you now set the object to its new position, it will be centered to the previous position you like.

The only problem is that you have a new position you have to handle.

Share this post


Link to post
Share on other sites
Guest
You can take modelToWorld [0,0,0] to get its real center. Then get the difference between pos and modelToWorld and add it to pos. When you now set the object to its new position, it will be centered to the previous position you like.

The only problem is that you have a new position you have to handle.

wow thank you i0n0s

I'll have to try that. It wouldnt be that bad to put in, as at least I am still using just the one object for reference. In fact it would be pretty easy, hopefully it works smile_o.gif

Thanks again

Share this post


Link to post
Share on other sites
Guest

Problems..

I cant seem to get the difference between worldToModel and object Pos correct here in script, or something is wrong..

Maybe someone can help me here

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#SelectObject

_TempNumberSwitch = 0

_DifferenceOfX = 0

_DifferenceOfY = 0

_DifferenceOfZ = 0

_TrueWorldPos = CurrentObject worldToModel [0,0,0]

player sidechat format ["object world to model position is %1",_TrueWorldPos]

player sidechat format ["object getPos is %1", getPos CurrentObject]

_SelectedObjectPos = getPos CurrentObject

_WTMPosX = _TrueWorldPos select 0

_WTMPosY = _TrueWorldPos select 1

_WTMPosZ = _TrueWorldPos select 2

_TempObjectPosX = _SelectedObjectPos select 0

_TempObjectPosY = _SelectedObjectPos select 1

_TempObjectPosZ = _SelectedObjectPos select 2

? _WTMPosX > _TempObjectPosX : _DifferenceOfX = _WTMPosX - _TempObjectPosX

? _WTMPosX < _TempObjectPosX : _DifferenceOfX = _TempObjectPosX - _WTMPosX

? _WTMPosX == _TempObjectPosX : _DifferenceOfX = _WTMPosX

? _WTMPosY > _TempObjectPosY : _DifferenceOfY = _WTMPosY - _TempObjectPosY

? _WTMPosY < _TempObjectPosY : _DifferenceOfY = _TempObjectPosY - _WTMPosY

? _WTMPosY == _TempObjectPosY : _DifferenceOfY = _WTMPosY

? _WTMPosZ > _TempObjectPosZ : _DifferenceOfZ = _WTMPosZ - _TempObjectPosZ

? _WTMPosZ < _TempObjectPosZ : _DifferenceOfZ = _TempObjectPosZ - _WTMPosZ

? _WTMPosZ == _TempObjectPosZ : _DifferenceOfZ = _WTMPosZ

_TempObjectPosX = _TempObjectPosX + _DifferenceOfX

_TempObjectPosY = _TempObjectPosY + _DifferenceOfY

_TempObjectPosZ = _TempObjectPosZ + _DifferenceOfZ

TempPos set [0,_TempObjectPosX]

TempPos set [1,_TempObjectPosY]

TempPos set [2,_TempObjectPosZ]

player sidechat format ["object final center position is %1",TempPos]

~20

goto "loop"

What it does is just sends the object off to some crazy place..

cant get this right sad_o.gif

Share this post


Link to post
Share on other sites

The ?-code is wrong because that code will give you the absolute difference between the positions. But you need the difference with signs.

So just use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

DifferenceOfX = _WTMPosX - TempObjectPosX;

DifferenceOfY = _WTMPosY - TempObjectPosY;

DifferenceOfZ = _WTMPosZ - TempObjectPosZ;

If this moves the objects in the wrong direction switch WTMPos and TempObject.

Share this post


Link to post
Share on other sites
Guest
The ?-code is wrong because that code will give you the absolute difference between the positions. But you need the difference with signs.

So just use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

DifferenceOfX = _WTMPosX - TempObjectPosX;

DifferenceOfY = _WTMPosY - TempObjectPosY;

DifferenceOfZ = _WTMPosZ - TempObjectPosZ;

If this moves the objects in the wrong direction switch WTMPos and TempObject.

Thanks man smile_o.gif

I'll try that out, phew I was getting frustrated, thanks for the help! biggrin_o.gif

Share this post


Link to post
Share on other sites
Guest

After spending some time testing, and getting help from ColonelSandersLite on the subject - it seems worldToModel is returning the same x,y position as getPos is, which is making this not work.

@Ionos

I may have misunderstood exactly what you were saying, as I think maybe you are implying to do the following to get the 'true' center point of an object :

get current pos of object, store it

setPos the object, now get the new object position, store it

get the difference between the two positions [x,y,z]

Add difference to the current position (or maybe the original position, have to try both maybe)

this is the best I can surmise, I will have to try it to see if the object is 'reset' to its original position.

Share this post


Link to post
Share on other sites
Guest

Still getting a failure, the object is being sent off, as usual to some distant place.

Might you have a script snippet handy of how you have done this Ionos? I could really use an example that is solid, Im not sure waht Im doing wrong, the value is being added like it should be.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_object setVariable ["ION_RTE_OBJECT_POS", _pos];

_object setPos _pos;

if (ION_RTE_Setting_NewSetPos) then {

   _mTw = _object modelToWorld [0,0,0];

   _vct = [_mTw, _pos] call ION_RTE_fVectorTo;

   _vct set [2, 0];

   _pos = [_pos, _vct] call ION_RTE_fVectorAdd;

   _object setPos _pos;

};

With ION_RTE_Setting_NewSetPos = false:

w2kgtdii.jpg

True:

bp283bxf.jpg

The circle is around the position used with setPos.

So you see the effect and it's working nice smile_o.gif

Share this post


Link to post
Share on other sites
Guest
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_object setVariable ["ION_RTE_OBJECT_POS", _pos];

_object setPos _pos;

if (ION_RTE_Setting_NewSetPos) then {

_mTw = _object modelToWorld [0,0,0];

_vct = [_mTw, _pos] call ION_RTE_fVectorTo;

_vct set [2, 0];

_pos = [_pos, _vct] call ION_RTE_fVectorAdd;

_object setPos _pos;

};

With ION_RTE_Setting_NewSetPos = false:

w2kgtdii.jpg

True:

bp283bxf.jpg

The circle is around the position used with setPos.

So you see the effect and it's working nice smile_o.gif

Awesome m8 smile_o.gif

Sweet pics there too!

I will review what you have there and put it into action.

Full credit will be given to you for accomplishing this (complex) task in the wall modifier release, and credit in my mission itself for your help with this as well.

Great man, thank you smile_o.gif

Share this post


Link to post
Share on other sites
Guest

okay, I must ask, one problem, the main thing Im missing is the math, how exactly your ION_RTE_fVectorTo, and ION_RTE_fVectorAdd are getting proper coordinates.

Share this post


Link to post
Share on other sites
Guest

Thanks for the help, but i give up smile_o.gif

Too much time spent on this, and I cant get the math info to set an objects local to its original position. Prolly wont release this, as I doubt anyone, aside from me for my mission, wants to deal with a wall modifier that moves a wall piece out of line upon initial selection, which is understandable.

Thanks for the help everyone, moving on smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×