Author Topic: Destructible stations - NPC spawn location x and y rounded?  (Read 922 times)

ninekorn

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Destructible stations - NPC spawn location x and y rounded?
« on: August 03, 2019, 01:16:35 pm »
Hi, I just wanted to know if when using the generator.AddNPCShipToSystem if the position x and y are actually rounded instead of using the exact location where i want them spawned.

Below picture shows why i am asking. I am able to create destructible parts from Blender and then from the destructible parts, i am creating "turrets" without AI to drive them, and I put their weapon invisible, which makes it so that i have static Walls in place for the station and those walls are destructible. Although I set the correct pivot location for every object in Blender and double checked they were correctly aligned, they aren't spawned where i want them to in Void Expanse. Any ideas why?




EDIT: Nevermind about my question.... I just printed to console and the correct position is supposed to be set. That is confusing me.
« Last Edit: August 03, 2019, 01:51:59 pm by ninekorn »

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1617
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #1 on: August 03, 2019, 03:46:28 pm »
Hello!

So they're spawned in the correct location...I'm not sure why they're not displayed exactly as they spawned. Are you sure the location is not changed after spawn? If you're using physical shapes for these objects they might pull each other away. Have you tried spawning them without physical colliders? Also, have you tried using simple 3D cube models to check that the issue is not related to 3D models?

Regards!

ninekorn

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #2 on: August 03, 2019, 04:07:00 pm »
Hi ai_enabled, i'm going to try different models in Blender. I think that "maybe" the issue is related to the pivot point again... Although they are all at the perfect axis Z location, their pivot point in axis X and axis Y are different.

I had to learn to code a bit of Python in 3 days to make all of this work. The models are all exported by code, the XML files by code, the png's by code, the floor are decorations but the walls are turrets... Lol it was a lot of work but python is interesting for sure. It must've taken me 4-5 hours just to insert the XML nodes in code so that the xml files load in Void Expanse, but the nice thing is that it now works. I can use Python with models of Blender that I export from code and everything is done automatically for, in this case, over 100+ models.

I will try to align all of the pivot points so that they are aligned all with the same distance from each other if i can... Im not sure yet how to do this as manipulating pivot point from code in Python is not super user friendly, unless you know the API functions. I mean blender python code is scarce compared to unity c# and unity javascript.

« Last Edit: August 03, 2019, 04:28:01 pm by ninekorn »

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1617
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #3 on: August 03, 2019, 04:23:46 pm »
Python skills are certainly useful :-)

So, I would suggest simply using a 1*1*1 cube model and spawning it as multiple turrets on exact 1 unit distance between them. This should work properly if your units conversion is done properly, otherwise, there will be regular intervals between all objects.

Regards!

ninekorn

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #4 on: August 03, 2019, 06:32:39 pm »
So, I manually set each Pivot to be exactly the same X as any other objects in the same X axis row of walls..

It looks like this in blender. But when I export to .obj, i set the position of each object to x=0 and y=0. The original position of the object is kept in memory and used in the name of the XML file so that I can use that ingame to spawn turrets to the offset where they are supposed to be just like in Blender. I output the names of the XMLs by code to a notepad and just copy paste them to the library in Void Expanse for spawning them. Super fast instead of manually doing everything, and with the number of times that I gotta rebuild them in Void Expanse to test if they are aligned, it sure helps to have an automation on the workflow.






But again, it gives me this result in Void Expanse lol. They are now aligned with the axis X but not with the axis Y... haha wth am i doing wrong. Geez. Blender and the pivot is annoying me ;)






Im gonna try next the same distance between each walls.


And now with an offset of 2.25 units in the Y axis from blender for every model's pivot point gives this... Like... Huh?




OH... there is a detail you mentioned and I am not sure that i got it right. The unit conversion. I am using the exact units from blender without any changes. You can see in the void expanse screenshots that something is wrong where the wall tiles are "spawned" a little bit short in distance compared to the floor tiles which isnt supposed to happen, the floor tiles to the left extremity should be aligned with the last wall too. So definitely, it must be the unit conversion the issue. I'm gonna look for some fix on this.




Funny thing it works when i actually remove 2.25 units from the first wall at each extremity in Void Expanse Javascript when spawning the walls. Example, i take the Y position from the xml file name of the most right or most left wall, than I add or remove 2.25 units in Javascript when spawning the walls. It works like that but it means that the units that i get from Blender aren't working. Im not sure if I already asked you ai_enabled in some other post what the units of Void Expanse are compared to those in Blender. Please enlightened me when you get the chance, otherwise, this whole thing will be a pain to make offsets in code for everything to line up .Thank you
 
« Last Edit: August 04, 2019, 02:20:09 pm by ninekorn »

ninekorn

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #5 on: December 12, 2019, 04:17:38 am »
ai_enabled,

I am working back again on the destructible stations. if you ever have a minute, could you please answer my question about which units i should use in blender when exporting the models xml files like cm or mm or inches etc?

here is how my files name look and how i am able to get the correct offset location that they are supposed to be at in-game:

xml_outpostOuterWall0posX-15_71593952178955posY-3_96260404586792.xml
hull_outpostOuterWall0posX-15_71593952178955posY-3_96260404586792.xml
hull_outpostOuterWall0posX-15_71593952178955posY-3_96260404586792.obj
hull_outpostOuterWall0posX-15_71593952178955posY-3_96260404586792.png

So in code i simply use string.replace in order to swap the "underline" character and replace it with a dot instead.
var posX = XMLTitlePosX.replace("_", ".");
var posY = XMLTitlePosY.replace("_", ".");

And in order to get the correct location of the digits in the XML name i use indexOf:
var indexPosX = arrayOfWallXML.indexOf("posX")
var indexPosY = arrayOfWallXML.indexOf("posY")

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1617
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #6 on: December 12, 2019, 06:38:33 am »
Hi,
I'm not sure which units we were using for the models in Blender but I guess it's standard 1 unit == 1 meter.
The Blender export settings which we've used then are posted here on a screenshot http://wiki.atomictorch.com/VoidExpanse/Adding_Ships

Regards!

ninekorn

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Destructible stations - NPC spawn location x and y rounded?
« Reply #7 on: December 12, 2019, 07:12:55 am »
ok thank you for the fast response ai_enabled. Ill try and find some alternative to help me get the correct pos otherwise ill just go do it "trial and error".