Why do my bullets always go the wrong way when my player turns around?

So I tried to make a shooting mechanism for my game. My player can shoot in the direction pointed by the mouse. My player can also turn around, facing the other way as he walks. The firing mechanism is fine when my player is facing right, but when my player is facing left (I used transform.localscale and set my x scale to a negative value so my player sprite is flipped) the gun is also reversed, i solved the problem on the gun, but when i shoot the bullet, the first bullet fired after i turn around will go in the wrong direction. I set my weapon as child of an empty game object named gunHolder like this:

enter image description here

When it play, it looks like this, when i trun around and shots my first bullet, the bullet go in mirror direction:

how it looks like when it play

My shooting code look like this:

void FixedUpdate()     {                  Vector3 difference=Camera.main.ScreenToWorldPoint(Input.mousePosition)-transform.position;         float rotZ=Mathf.Atan2(difference.y,difference.x)*Mathf.Rad2Deg;                  if(player.transform.localScale.x==1)turnOffset=0;         else turnOffset=180;          transform.rotation=Quaternion.Euler(0f,0f,rotZ+offset+turnOffset);         if(timeBtwShots<=0){             if(Input.GetMouseButtonDown(0)){              Instantiate(projectile,shotPoint.position,transform.rotation);              float transX= (float)(player.transform.localScale.x*0.3);             projectile.transform.localScale= new Vector3(transX,projectile.transform.localScale.y,projectile.transform.localScale.z);              BulletBehaviour bulletBehaviour=projectile.GetComponent<BulletBehaviour>();             if(player.transform.localScale.x==1){                 bulletBehaviour.flip=false;             }             else{                 bulletBehaviour.flip=true;                 Debug.Log("flip");             }             timeBtwShots=startTimeBtwShots;         }         }else{             timeBtwShots-=Time.deltaTime;         }              } 

So I flip my weapon based on where my player is facing. I handle my player animation when facing another direction by changing transform.localscale.x:

scale=transform.localScale; if (Input.GetKey(KeyCode.A))      {           isMoving=true;           Vector2 movement = transform.right.normalized * -moveSpeed;           rb.AddForce(movement);           scale.x=-1;      }      else if (Input.GetKey(KeyCode.D))      {           isMoving=true;           Vector2 movement = transform.right.normalized * moveSpeed;           rb.AddForce(movement);           scale.x=1;      } 

And my bullet script look like this:

void Update()     {         if(!flip){             transform.Translate(Vector2.right*speed*Time.deltaTime);                          }         else {             transform.Translate(Vector2.left*speed*Time.deltaTime);             }     } 

Based on where my player facing, i change my bullet direction(I did this because before, my bullet went in the wrong direction if my player was facing left). Now my bullets are facing the right direction, it’s just that the first bullet that is fired after my player turns around always goes in the wrong direction (the opposite direction to the direction it should be, even the sprites are reversed). Anyone know why this happening and how to solve this?

Balancing Encounters around a very proficient Necromancer

In a game I am a part of there is a player who considers themself a necromancer. They are fully specced and invested around the spell "Animate Dead". They are very effective and efficient at keeping track of, and controlling their minions, often taking a minute or few for their full turn with 7 fielded minions, each with multiple attacks. The problem is that they are really really powerful. Their control/raise limit is well over what it should be for their level (+9 from a mixture of class abilities and feats/traits that raise CL.) This means they have been able to raise anything that we have come across as at least a bloody skeleton, even adding extra template via use of desecrate. They also pair this with an elevated CL Command undead spell, giving them a large swath of minions to use that are hard to permanently kill.

The setting of the campaign has been the deep darklands, and while we are only level 7, they have given raise to 15HD bloody Firey skeletons. Needless to say, these outperform any martial at the same level.

The party is a small group, with 1 other consistent player who is a Rouge/Arcane trickster, (about as well optimized as they can be with a couple boons to make them stronger) and then a guest player every now and then who is less important and not consistent. As a GM it is getting hard to balance encounters because as the opponents scale up, the party does as well, but the characters do not gain extra capability. No one in the party is upset at the level of power they have, as they generally tend to do different rolls then meat-bag front-line. However they still like to feel useful in combat, and if enemies are too scaled up, they cant hurt them easily.

What are some ways to allow for more balanced encounters? The challenge is providing something that can be a threat to creatures of that capability, while still proving to be a threat to the rest of the party. Im not looking to nerf them unless absolutely necessary. The necromancer has his body hidden inside the skeleton of a large creature, strapped, secured, and hidden, while using shadow projection to command and be safer on the battlefield. AOEs can threaten his body, but its hard to justify direct targeting of his body over the skeleton it resides in, which is also quite mobile. Keep in mind, that the necromancer can raise pretty much anything, so after every encounter, they can potentially get stronger, and can at this point raise (7+5CL x2 = 24 x2 from desecrate = 48) a 24 HD creature as a bloody skeleton, or a 12 HD creature as a bloody flaming (or elemental) skeleton. This is at level 7.

Normalize a rotation around the Z-axis (issue with GLM)

I’m trying to undo some transformations coming from an external tool*. I’m getting different results depending on subtle differences in the input and wondering how to convert to a rotation about the Z-axis only.

The transformations are expressed as a matrix = translation * rotation * -translation. I want to decompose the resulting matrix into a single translation and rotation around Z — I know this is possible given the source material (2D plane).

My problem is coming from GLM decompose. Given a matrix that looks like this:

[         -0.5 |     0.866025 |            0 |            0 ] [    -0.866025 |         -0.5 |            0 |            0 ] [            0 |            0 |            1 |            0 ] [            0 |            0 |            0 |            1 ] 

If I call decompose, then take the eulerAngles of the Rotation I end up with either:

  • ( 0, -0, 2.09439 ) from quat( 0.5, 0, 0.866025, 0 )
  • ( 3.14159, 1.0472, 3.14159 ) from quat( 0.5, 0, 0, 0.866025 )

The difference depends on how the matrix was generated, whether the rotation was 120degrees or -240degrees. The display must be clipping the floating point, introducing a subtle change.

I’m assuming both these rotations are actually the same.

How do I force/convert the result to be a rotation about the Z axis only.

*The external tool is Inkscape which uses the CSS/SVG function rotate(r, cx, cy) instead of a rotation and transform. That function results in the matrix: translate(cx,cy,0) * rotate(r, (0,0,1)) * translate(-cx,cy,0)

How to move my item slots around

Looking over the items I’m going to want for my character, I find myself wanting two neck slot items (an Amulet of Mighty Fists and a Necklace of Ki Serenity).

The Hand of Glory allows a character to wear an extra ring by taking up third neck slot, are there any other items that exchange what slot can be used where? (Hopefully one to let me wear more than one necklace at a time?)

Cylindrical billboarding around an arbitrary axis in geometry shader

I found an answer on this site relating to this question already, but it doesn’t seem applicable in the context of my project.

Basically I’d like to create a method which fits this signature:

float3x3 AxisBillboard(float3 source, float3 target, float3 axis) 

That is to say, when given a source point (i.e an object’s position in world space), a target (camera position in world space), and an axis (the object’s up vector, which is not necessarily the global y axis), it produces a 3×3 rotation matrix by which I can multiply the vertices of my point so that it’s properly rotated.

I’ve found many solutions and tutorials online which work nicely assuming I only want to rotate around the y axis.

For example, here’s a solution which billboards around the global y axis:

float3 dir = normalize(target - source);      float angleY = atan2(dir.x, dir.z); c = cos(angleY); s = sin(angleY);      float3x3 rotYMatrix; rotYMatrix[0].xyz = float3(c, 0, s); rotYMatrix[1].xyz = float3(0, 1, 0); rotYMatrix[2].xyz = float3(-s, 0, c); 

For context, I’m working on a grass shader, and each individual blade of grass should be billboarded to face the camera while remaining aligned with the normal of the terrain.

PageSpeedInsights shows 0 CLS, but field data around 0.30 CLS

Lab data, as well as online analysis tools show my site to have 0 CLS issues in mobile and desktop versions. However, Google field data is showing 0.30 CLS issues, (Critical, no passing level!).

I want to ask: is this to be expected and typical? I have no other ideas on how to fix this. I wonder how people can still experience CLS…. perhaps they are on older devices that don’t respond to modern code, therefore having CLS issues?

Thank you! Dave

“Escalate” the other way around

Can escalation go the other way around? such as from gunshot to melee or from melee to just talking?

For example, two players were having a shooting contest, and I called for acuity + will, at some point the losing player decided to "escalate" and punch the contender on the face.

Other example: Two players are arm wrestling until a player says "I wonder if you are a better arm wrestler or a better liar?"

Does turning around count as moving for triggering Brace?

My fighter took Superior Technique as Fighting Style. This gives me the the Combat Maneuver Brace, from Unearthed Arcana, which says (emphasis mine):

When a creature you can see moves into the reach you have with the melee weapon you’re wielding, you can use your reaction to expend one superiority die and make one attack against the creature, using that weapon. If the attack hits, add the superiority die to the weapon’s damage roll.

The wording of a similar mechanic in the Polearm Master feat differs slightly:

While you are wielding a glaive, halberd, pike, quarterstaff, or spear, other creatures provoke an opportunity attack from you when they enter the reach you have with that weapon.

The word "enter" makes it very clear to me that the opponent needs to enter the reach for the trigger to happen, but "moving into" is less clear to me. It could be that they are semantically the same, but both my DM and I are unsure.

So, for example, if the opponent is already within my reach and it turns around to attack someone else: does turning around count as moving for triggering Brace?

Practical experience around essence scarcity or lack thereof in Exalted 3E

We are converting from a previous editiont to e3 and to me it looks like essence is unlikely to become a scarce resource. I’m especially thinking of the rule that you regain 5 motes of Essence each combat turn, and that your regaining motes as time passes even when not resting.

p174 Core Rule Book

Characters with mote pools regain five motes of Essence at the end of each round while in combat, as the dynamism of battle stirs the world around them. Outside of battle, characters regain five motes per hour. In the most relaxed of times—such as when a character is asleep, meditating, or quietly reading—they respire Essence at a rate of 10 motes per hour.

I’m looking for practical experience from play on how this actually works out.

My assumption that is that there is something I’m not understanding and that somehow it becomes a scarce resource even in combat where you regain 5 essence a round. A perfect answere would include references to the rules, but also excamples of how they could be used. The ideal excamples for me are based on starting character solar or dragon blooded.