Jump to content
Sign in to follow this  
austin_medic

Object Generation loves building diagonally instead of in straight lines?

Recommended Posts

I got a bit of a problem when I returned to procedural object generation today, seems no matter what I do the game refuses to spawn VR blocks in a straight line. Instead it only builds diagionally and the blocks are not directly beside each other like they should be.

Anybody know what I'm doing wrong?

EDIT:

Got it connecting the first and second block spawned, rest still don't connect to the first two, and are spaced apart.

Steam Pic

My Code:

_object = _this select 0; //passing a classname as string to script for building.
_position = player;
_buildings = 0;
_newObjPos = [];
while{_buildings < 10} do
{
_centerpos = [(Getpos _position select 0) + 50 + round(random 200),(Getpos _position select 1) + 50 + round(random 200),(getpos _position select 2)]; 
_cObject = _object createVehicle _centerPos;
_cObject setPos _centerPos;
_amount = 10 + round(random 30);
_sideways = false;
_i = 0;
for "_i" from 0 to _amount do
{
	if(_i < 1) then
	{
		_newObjPos = [(Getpos _position select 0) + 1,(Getpos _position select 1),(getpos _position select 2)];
		if(_sideways) then
		{
			_newObjPos = [(Getpos _position select 0) + 1,(Getpos _position select 1),(getpos _position select 2)];
		}
		else
		{
			_newObjPos = [(Getpos _position select 0),(Getpos _position select 1) + 1,(getpos _position select 2)];
		};
	}
	else
	{
		_newObjPos = [(_newObjPos select 0) + 1,(_newObjPos select 1),(_newObjPos select 2)];
		if(_sideways) then
		{
			_newObjPos = [(_newObjPos select 0) + 1,(_newObjPos select 1),(_newObjPos select 2)];
		}
		else
		{
			_newObjPos = [(_newObjPos select 0),(_newObjPos select 1) + 1,(_newObjPos select 2)];
		};
	};
	_newObject = createVehicle[_object,_newObjPos, [], 0, "CAN_COLLIDE"];
	if(_i < 1) then
	{
		_newObjPos = [(Getpos _position select 0) + 1,(Getpos _position select 1),(getpos _position select 2)];
		if(_sideways) then
		{
			_newObjPos = [(Getpos _position select 0) + 1,(Getpos _position select 1),(getpos _position select 2)];
		}
		else
		{
			_newObjPos = [(Getpos _position select 0),(Getpos _position select 1) + 1,(getpos _position select 2)];
		};
	}
	else
	{
		_newObjPos = [(_newObjPos select 0) + 1,(_newObjPos select 1),(_newObjPos select 2)];
		if(_sideways) then
		{
			_newObjPos = [(_newObjPos select 0) + 1,(_newObjPos select 1),(_newObjPos select 2)];
		}
		else
		{
			_newObjPos = [(_newObjPos select 0),(_newObjPos select 1) + 1,(_newObjPos select 2)];
		};
	};
	_newObject setPos _newObjPos;
	_i = _i + 1;
	sleep 0.5;
};
_buildings = _buildings + 1;
sleep 1;
};

Share this post


Link to post
Share on other sites

You add 1 to X coordinates in every case:

	if(_i < 1) then
	{
	_newObjPos = [(Getpos _position select 0) + 1,(Getpos _position select 1),(getpos _position select 2)]; // THIS RIGHT HERE
		if(_sideways) then

Even when you apparently want them to spawn along the Y.

And the 2m space is because the if(_i < 1) is run twice.

Edited by Greenfist

Share this post


Link to post
Share on other sites
You add 1 to X coordinates in every case:

	if(_i < 1) then
	{
	_newObjPos = [(Getpos _position select 0) + 1,(Getpos _position select 1),(getpos _position select 2)]; // THIS RIGHT HERE
		if(_sideways) then

Even when you apparently want them to spawn along the Y.

And the 2m space is because the if(_i < 1) is run twice.

Right. Got it working now, thx.

Share this post


Link to post
Share on other sites
BIS_fnc_relPos

Because screw trigonometry!

it... makes... life... so... much... easier..........

edit:

got it building 4 walls and a roof. creating doorways still seems to be a bit glitchy,sometimes it deletes parts of a section of wall and other times it only deletes the bottom block thats supposed to be two blocks high....

edit edit: also got a problem with buildings clipping through each other when they're too close.

http://cloud-4.steamusercontent.com/ugc/546394464816693635/22E5C6BE298756C1A6665A59D4876BFE3F473D5C/

Edited by austin_medic

Share this post


Link to post
Share on other sites

Just a heads up: It would probably be more apt to use the vector commands instead of BIS_fnc_relPos.

Share this post


Link to post
Share on other sites

Actually, looking at your picutre, I'm kinda interested in what piece you're using to build your houses?

Share this post


Link to post
Share on other sites
Actually, looking at your picutre, I'm kinda interested in what piece you're using to build your houses?

its the standard VR_Stand block, the reason they dont have horazontal lines in the bricks is because they are hidden inside each other when they are built, though you can see a tiny bit of Z-fighting going on with it clipping through the surface of other objects.

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  

×