Jump to content

What defines the center of an object?


Recommended Posts

I noticed when the AnimState:SetOrientation is ANIM_ORIENTATION.BillBoard (like it is for most "kind of 3D" objects, like trees) The object will rotate around their center when the player is rotating the camera.

Now I have the problem that for my object this center is at a poor place, I would like to move it elsewhere. Is this possible with code? Or do I have to change the anim? Or is it something different?

Link to comment
Share on other sites

27 minutes ago, thomas4845 said:

i think you can change it via code but it may be a set spriter thing, this could be the centre of the image itself 

thanks. I found no code for it, I guess it is indeed defined in the anim.

I just use spriter for the first time of my life (I'm a coder, not an artist :D)
I used krane to convert the build.bin, anim.bin und .tex to png files and scml spriter file.
Then I used spriter to move the assets a little bit so the new center should be fine.
I saved it as "test.scml".

Then I put the test.scml together with the png folders into my mod into "exported" folder.
I started the game and the autocompiler converted this into a test.zip.
But this test.zip contains an animation.xml, build.xml and the png files... how do I get to .bin files?
I tried the current test.zip , but it is not working, the object is invisible ingame, so I guess I have to convert it first to .bin ? but how?

(the build is the the name of the scml/zip file, so "test", right? And the bank is the one shown on the right within spriter. So this should be correct)

Edited by Serpens
Link to comment
Share on other sites

can you show me the code for object itself (if it is one) , it usually has files that are not named properly and sometimes using spriter does not work correctly so you may need to make it again(sorry)

the problem may be much more simple, but about this .bin  i have no clue 

i am drawer not an animator XP

Link to comment
Share on other sites

local assets =
{
    Asset("ANIM", "anim/test.zip"),
    -- Asset("ANIM", "anim/pig_room_wood.zip"),
}

local function fn(inst)
    local inst = CreateEntity()
    inst.entity:AddTransform()
    inst.entity:AddNetwork()    
    inst.entity:AddAnimState()
    inst.AnimState:SetBank("pig_room")
    
    inst.AnimState:SetBuild("test")
    -- inst.AnimState:SetBuild("pig_room_wood")
    
    inst.AnimState:PlayAnimation("idle",true)
    inst.AnimState:SetOrientation(ANIM_ORIENTATION.Billboard)
    inst.AnimState:SetLayer(LAYER_WORLD_BACKGROUND) 
    inst.AnimState:SetSortOrder( 3 )
    
    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end
            
    return inst
end

return  Prefab("housewall", fn, assets)

(wow the test.zip is ~60 times bigger than the original zip I edited?! is png really that much bigger then tex? Does the game not autocompile png to tex?

pig_room_wood.zip

test.zip

Link to comment
Share on other sites

jeez why is it 28 mb

OK personaly i am as clueless as you so i'm just gonna throw some answers hoping 1 will work.

1.you may have not actually made an idle animation , if you do try to rename some stuff i don't remember why but this worked for me

2.bank may need to renamed to test

3.the program your using may not be working correctly, sometimes the problem is just the program so you may need to reinstall it

i'm no coder and tbh our school is just letting us learn but i hope i helped some way

Link to comment
Share on other sites

it's strange, I tried to decompile pig_room_wood then moved those folders extractly to exported and for me the game doesn't even compile this correctly so I'm not provided with the zip in anim folder. I've never had this issue before, the anims I get after compiling normaly do provide me with the build files. I never tried to manually compile but I tested that too and that came back as an error for me so I'm not sure why this happens for these files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...