The design of my character is off-center... they carry a weapon. Because of this, when I flip them from left to right, it looks like the character jumps from side to side. How do I adjust the centerline so they flip based on the center of their body instead of the center of the sprite? Thanks!
How do I adjust the centerline of a Character when I flip them from left to right?
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Use layered implementation (you can freely position layers inside the prefab there) or add slack transparent space to the texture when using sprite implementation. Starting with v1.16 diced sprite implementation also allows specifying custom pivots.
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Hi Elringus,
Thanks for the reply. In my case, the character is a "SpriteCharacter", can you explain in more detail how to "add slack transparency space to the texture"? Is there a setting in Unity/Naninovel to do this, or do you mean adding transparent space to my png file in an image editor before bringing it into Unity?
Thx!
-
- support
- Posts: 275
- Joined: 01 Aug 2020 08:25
Re: How do I adjust the centerline of a Character when I flip them from left to right?
By slack transparency he probably meant to add extra transparent pixels so the body of the characters is centered on the image. I don't think it's possible to do within Unity.
If space is a concern then I recommend registering your copy and downloading the 1.16 pre-release in our Discord channel which now has an option to set a custom pivot via Diced Sprite Atlases: https://naninovel.com/support/#naninovel-support
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Hi idaot,
Thanks for the help. I went with the Diced Sprite option. I got the dicing working, but changing the pivot doesnt seem to have any effect. For the record, I made sure to "Rebuild Atlas" after I adjusted the pivot.
Is there a setting somewhere else I need to adjust?
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Make sure you're using latest sprite dicing version and Keep Original
is enabled in atlas settings. You can find example of custom diced sprite pivots controlled by sprites of the original textures in the sprite dicing project.
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Thanks. "Keep Original" doesn't seem to help me center my character when I flip it with the "look" command. Where can I find the sprite dicing project?
I made a visual representation of the problem I'm trying to solve. Thanks for the help!...
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Don't forget to specify the custom pivots for the source textures (sprites) with sprite editor: https://docs.unity3d.com/Manual/SpriteEditor.html
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Thanks for the tip.
I followed this tutorial: https://www.youtube.com/watch?v=6PdOAOsnhio
Plus I set the custom pivots for all source sprites in the Sprite Editor like you suggested, and rebuilt the Atlas. But still, when I flip the image using "look", it acts like I didn't make any pivot adjustment at all.
Not sure what I'm doing wrong.
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
My bad, I misunderstood your use case. Diced implementation will render the source sprites to a texture, which has its own pivot that can be set in char config. It's not possible to specify custom pivot per appearance.
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Hi Elringus,
Thanks for the help. That pivots the character in relation to the screen, but that's not really addressing my issue.
My issue is... when I use the look command to flip my character, the flipped version doesn't line up how I need it to with the default (baked look direction) version. I need to offset the flipped version of the character only.
Could you revisit my visual above to see the problem? Thanks.
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
If you check this tutorial, first example, he addresses the same problem I'm having (he's showing it in Unity without Naninovel). I tried following his steps and it still didn't work. Pivot moves the default character around on the screen, but it doesn't offset the flip. https://www.youtube.com/watch?v=yVSa1wurt8s
Also I noticed I don't see a "Sprite Renderer" panel where I can check the Flip. Is there a way to turn it on? Thx.
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
The char pivot controls pivot relative to sprite, not the screen. As I've mentioned before, most implementations render source representation of the actor to a texture. Look command basically flips that render texture and pivot won't affect the process (sorry for the misleading info on that in my initial answer). I'd still suggest trying a layered implementation or centering your characters on the source textures. You can flip them manually (eg, flip horizontally with PS) to estimate how the look command will work in the engine.
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Sorry for confusion on this.
You said "The char pivot controls pivot relative to sprite, not the screen."
If I understand correctly, doesn't that mean I should be able to place the X-axis pivot point right down the center of the character's body and when I flip the character using the look command, it should flip the image along that line? That's what I'm trying to do but it doesn't seem to work.
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Pivot doesn't affect how the look direction is applied in any way, as it just flips the texture. Try performing flip horizontally in photoshop for an example.
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Understood. I was able to get the flip to line up correctly by creating a layered character like you suggested. Thank you!
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Hey Elringus,
I noticed when I use the Layered Character method, when I transition from one sprite to the other, the first sprite flashes to black and fades away. For example:
@char Test.Outfit1>Annoyed1
1
@char Tester.Outfit1>Annoyed2 <As soon as this switches to "Annoyed2", "Annoyed1" flashes to black and fades away.
2
When I use a regular Sprite Character, the transition is transparent and looks much smoother. Is there a way to turn off that black thing? Thanks!
-
- admin
- Posts: 538
- Joined: 11 May 2020 18:03
Re: How do I adjust the centerline of a Character when I flip them from left to right?
Please PM me on Discord with a repro project (https://naninovel.com/support/#reproduction-project).
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
-
- Posts: 32
- Joined: 30 Mar 2021 10:58
Re: How do I adjust the centerline of a Character when I flip them from left to right?
To help anyone reading - Elringus was able to find and fix the error with the transition looking black instead of transparent. I imagine that will be fixed in an upcoming release.