[csharp] Port of commit e177661. Improved physic constraint rotate().

This commit is contained in:
Harald Csaszar 2024-01-22 17:59:33 +01:00
parent 900e92ba46
commit 05e37fc738
3 changed files with 9 additions and 10 deletions

View File

@ -122,14 +122,13 @@ namespace Spine {
}
/// <summary>
/// Rotates the physics constraint so next <see cref="Update(Physics)"/> forces are applied as if the bone rotated an additional
/// amount in world space.
/// Rotates the physics constraint so next <see cref="Update(Physics)"/> forces are applied as if the bone rotated around the
/// specified point in world space.
/// </summary>
public void Rotate (float degrees) {
public void Rotate (float x, float y, float degrees) {
float r = degrees * MathUtils.DegRad, cos = (float)Math.Cos(r), sin = (float)Math.Sin(r);
r = tx * cos - ty * sin;
ty = tx * sin + ty * cos;
tx = r;
float dx = cx - x, dy = cy - y;
Translate(dx * cos - dy * sin - dx, dx * sin + dy * cos - dy);
}
/// <summary>Applies the constraint to the constrained bones.</summary>

View File

@ -484,12 +484,12 @@ namespace Spine {
}
/// <summary>
/// Calls <see cref="PhysicsConstraint.Rotate(float)"/> for each physics constraint.
/// Calls <see cref="PhysicsConstraint.Rotate(float, float, float)"/> for each physics constraint.
/// </summary>
public void PhysicsRotate (float degrees) {
public void PhysicsRotate (float x, float y, float degrees) {
PhysicsConstraint[] physicsConstraints = this.physicsConstraints.Items;
for (int i = 0, n = this.physicsConstraints.Count; i < n; i++)
physicsConstraints[i].Rotate(degrees);
physicsConstraints[i].Rotate(r, y, degrees);
}
/// <summary>Increments the skeleton's <see cref="time"/>.</summary>

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-csharp",
"displayName": "spine-csharp Runtime",
"description": "This plugin provides the spine-csharp core runtime.",
"version": "4.2.10",
"version": "4.2.11",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",