Jump to content

Object Doublesided


Bonsai

Recommended Posts

Hey,

there are some objects that are double sided by default, and apparently stay like that even if they have the "doublesided" attribute in a .map file set to false.

So when I load those objects myself, the default doublesided attribute is overwritten, since it says false in the map file, which makes them look different to how they are in the SA map.

Is there any way to know which objects have this?

I couldn't find anything about this neither in the MTA resources nor the MTA source code.

 

Bonsai

Link to comment
2 minutes ago, Bonsai said:

So when I load those objects myself

How are these being loaded?

2 minutes ago, Bonsai said:

there are some objects that are double sided by default, and apparently stay like that even if they have the "doublesided" attribute in a .map file set to false.

Is this when you first create an object in the map editor?

3 minutes ago, Bonsai said:

the default doublesided attribute is overwritten, since it says false in the map file

What happens when you reload the map in the map editor? The object.doubleSided attribute should be forced to the .map value, shouldn't it?

4 minutes ago, Bonsai said:

Is there any way to know which objects have this?

I'm not sure about this. I have a small hunch that this info is embedded in the dff/txd itself, but I don't actually know,

 

If my assumptions are correct (with this being a map editor issue), then this could be solved by forcing the double sided attribute to false when first creating the object.

  • Like 1
Link to comment

No, its not about the map editor.

I'm just loading maps with a custom map loader, going through the map file and create the objects later on.

But e.g. this glassy object:

7a76595a5e.jpg

It looks the same from inside:

7d467bfc98.jpg

When loading it with the default race resource, it looks like that too, having the double sided attribute set to false in the map file.

So when I load that object myself, the map file says doublesided is false, so I set it to false using setElementDoubleSided function.

And I guess that makes it only having one side visible, while actually both should.

So I think however MTA loads objects, there is something being done that I don't know about, to solve this.

Or maybe thats not the problem at all, but its the only thing that makes sense to me, since forcing doublesided to be true makes it look normal, but the map file says it should be false.

 

Bonsai

Edited by Bonsai
Link to comment

Try to use sth like this 

function START_DOUBLE_SIDED_TRANSACTION()
	_createObject = createObject
	createObject = createObjectDoubleSided
end

function END_DOUBLE_SIDED_TRANSACTION()
	createObject = _createObject
end

function createObjectDoubleSided( ... )
    local arg = {...}
	local temp = _createObject( unpack(arg) )
	setElementDoubleSided(temp, true) --Enable / disable
	return temp
end

it's making createObject always set the object as double sided.

START_DOUBLE_SIDED_TRANSACTION() 
-- put all your created object here
-- createObject(7488,1282.599609375, 1002, -6.0999999046326, 0, 0, 122.98101806641)
END_DOUBLE_SIDED_TRANSACTION()

 

 

Edited by Walid
  • Like 1
Link to comment

I was having the same problem.
 

local objects = {{},

{"object",id="object(vgn_corpbuild3)(1)",doublesided="false",model="6873",interior="0",dimension="0",posX="2015.6341552734",posY="-4775.201171875",posZ="24.309450149536",rotX="270",rotY="180",rotZ="180"}}

 

understand the logic logic.


 

  local object = createObject()

   if objects[2]  == "true" then
         setElementDoubleSided(object,true)
   end

do not use in all objects

setElementDoubleSided(object,true)

use only what is true

doublesided="true"

 

 if objects[2]  == "true" then

 

  • Like 1
Link to comment

I had problems with double siding also. My workaround was:

if(objectData.doublesided == true) then
    element:setDoubleSided(true)
end

while

element:setDoubleSided(objectData.doublesided)

didn't work. It is a boolean, I checked. Maybe it works now, who knows.

  • Like 1
Link to comment

Wow, thanks for your answers.

What Anony wrote really was the problem. 

If I only change the doublesided attribute if the map file says its "true", it works.

So for objects, that are doublesided by default, the map file actually shows the wrong value.

I was using isElementDoubleSided earlier when I started to think this might be the problem, but it returns false, even for the object shown in my other post, which actually is doublesided.

Anyway, thanks all! It finally works normally now.

 

Bonsai

  • Like 1
Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...