#[SOLVED] How do I use transformation groups?

2 messages · Page 1 of 1 (latest)

timid karma
#

What I want to achieve:

  • Position the mods on my gun in the right places. Specifically,
  • use the offset field in the animation parts' properties to offset the image locally (e.g. nudging the image upward from the supposed part's position)

What I'm doing:

  • Each mod is an animation part
  • The points where the mod animation parts are supposed to be positioned on the gun are specified in the gun's config file (e.g. "sightsOffset": [1, 1.125],
  • In the buildscript, I've been setting the animation part offsets to base offset + mod offset to position the sprites

Issues:

  • My above approach allows oversized sprites to clip into the weapon; I thus want to use the offset field to reposition the sprite locally
  • Since the buildscript recalculates the sprite offset accordingly, anything written in the respective mod animation part's offset field (in the config) is overwritten,
  • but anything written in the parameters overrides the offsets written by the buildscript, returning the part to the hand's position

Approaches:

  • I tried recalculating the mod offsets so that it inteprets the animation part offsets as image offsets but I got nowhere with this approach. Will try this approach again but I'm afraid I may be reinventing the wheel.
  • I attempted to use transformation groups to move the sprites around the weapon, but all animator functions that involve transformation groups don't move the animation parts at all

I'm pretty sure I'm doing something wrong. I hope someone can guide me to the right direction - I can provide any and all relevant pieces of code if needed

timid karma
#

Ended up reinventing the wheel. I manually added the mod offset to the animation part offset. I also identified the issue wherein gun mods that add their own animationCustom parameters make the sprite nowhere near it's supposed to be.

The culprit of the aforementioned issue I was having lies in the augment script for the mods. The buildscript seems to run when Item.new() is called, and the augment script modifies the custom animations after that fact. I ended up manually calculating the new offset in the augment script.