Skip to content

Update Quaternion#295

Merged
vladflotsky merged 1 commit intoExMod-Team:scpsl14from
ITeMbI4:SimplifySpawn
Dec 3, 2024
Merged

Update Quaternion#295
vladflotsky merged 1 commit intoExMod-Team:scpsl14from
ITeMbI4:SimplifySpawn

Conversation

@ITeMbI4
Copy link
Copy Markdown

@ITeMbI4 ITeMbI4 commented Dec 2, 2024

Description

Describe the changes

  • Make rotation optional for Pickup.Spawn, Pickup.CreateAndSpawn, Projectile.Spawn, Projectile.CreateAndSpawn and Ragdoll.CreateAndSpawn
  • Fix zero Quaternion

What is the current behavior? (You can also link to an open issue here)

What is the new behavior? (if this is a feature change)

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Probably yes

Other information:
A bit of context, why I delete default from Quaternion:

When you create a Quaternion with default value, it will be - new Quaternion(0f, 0f, 0f, 0f).
So, myRotation *= Quaternion.AngleAxis(90f, Vector3.up); will fail to rotate an object, because rotation is invalid.

So, I just change all zero Quaternion to a proper one - identity = new Quaternion(0f, 0f, 0f, 1f)

More in https://discussions.unity.com/t/why-are-quaternions-initialized-to-an-invalid-rotation-by-default/816397


Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentations

Submission checklist

  • I have checked the project can be compiled
  • I have tested my changes and it worked as expected

Patches (if there are any changes related to Harmony patches)

  • I have checked no IL patching errors in the console

Other

  • Still requires more testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants