Jump to content
Sign in to follow this  
jamez_5

1/2 in Ground 1/2 not

Recommended Posts

Hey guys. So here is what I want on the map: Land_New_WiredFence_10m_F

Here is the code i use: I put a sphere on the ground as an object. then use this.

pos = getpos this; dir = getdir this; this setpos [pos select 4, pos select 4, 6];

weapon1 = createVehicle ["Land_New_WiredFence_10m_F", Position this,[], 0, "can_collide"];

weapon1 setdir dir; deletevehicle this;

however every time I use this code it takes forever to get the object like i want it. Also it does not follow the ground level. So I saw this code:

_obj setVectorUp surfaceNormal position _obj;

I want it to follow the ground however I cant figure out the code i need. Also is there an easier way to connect a huge line of fences? Instead of moving it then checking if it matches up. Thanks in a advance

Share this post


Link to post
Share on other sites
pos = getpos this;
dir = getdir this;
this setpos [pos select 4, pos select 4, 6]; //position arrays only have 3 elements
weapon1 = createVehicle ["Land_New_WiredFence_10m_F", position this,[], 0, "can_collide"]; //why save position if you don't use it?
weapon1 setdir dir;
deletevehicle this; //never a good idea to create objects on top of each other, why bother moving it anyway, if you're just going to delete it?

pos = getpos this;
dir = getdir this;
//deleteVehicle this;
this setposATL [pos select 0, pos select 1, 6];
weapon1 = createVehicle ["Land_New_WiredFence_10m_F", position pos,[], 0, "can_collide"];
weapon1 setdir dir;

Not sure what you mean by half in ground, half not. Are you talking about the object itself? You will just have to manually figure out how high the object is and offset it that way.

I want it to follow the ground however I cant figure out the code i need. Also is there an easier way to connect a huge line of fences? Instead of moving it then checking if it matches up. Thanks in a advance

About this, it's absolutely possible, but it has to be done through a script. You'll need to figure out how long the object is (starting from the center point), then use trigonometry to get an actual position on the map. Luckily, the function BIS_fnc_relPos will be a huge help here, it can do the trig for you. But if that didn't exist, don't delude yourself, computer science is a very real science, sometimes you have to get your hands dirty. Personally, I've had to study up on math that I haven't learned about in years, and like every other kid, never thought I would ever use.

Share this post


Link to post
Share on other sites

heightOffset = 6;
weapon1 = createVehicle ["Land_New_WiredFence_10m_F", [0,0,0],[], 0, "CAN_COLLIDE"];
weapon1 setPosATL [(getPosATL this) select 0,(getPosATL this) select 1, heightOffset];
weapon1 setDir (getDir this);
deleteVehicle this;

however every time I use this code it takes forever to get the object like i want it. Also it does not follow the ground level. So I saw this code:

_obj setVectorUp surfaceNormal position _obj;

killzonekid - Fixing quadrupeds

and maybe this can help you

killzonekid - Building Bridges

Edited by KoVValsky

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  

×