Hi!
I'm trying to spawn a prefab at a specific Spine bone but it spawns at the wrong spawning point. It should spawn at the gun barrel. See image attachment. I have scaled up this Spine character, can that be it?
This is the code:
var delta = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
Vector2 firePointPosition = aimPointBone.GetLocalPosition();
if (delta.x > 0)
{ // mouse is on right side of player
Transform trail = Instantiate(BulletTrailPrefab, firePointPosition, Quaternion.Euler(aimPointBone.WorldRotationX, aimPointBone.WorldRotationY, 0f + offSetZ));
LineRenderer lr = trail.GetComponent<LineRenderer>();
if (lr != null)
{
lr.SetPosition(0, firePointPosition);
lr.SetPosition(1, hitPos);
}
Destroy(trail.gameObject, 0.04f);
}
Vector2 firePointPosition = new Vector2(aimPointBone.WorldX * transform.localScale.x, aimPointBone.WorldY * transform.localScale.y);
made it work!