mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[libgdx] Added worldToParent and parentToWorld so application code doesn't need to check the parent for null (when it is the root).
This commit is contained in:
parent
55e8cf5e78
commit
d65311dba0
@ -590,6 +590,18 @@ public class Bone implements Updatable {
|
||||
return local;
|
||||
}
|
||||
|
||||
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
||||
public Vector2 worldToParent (Vector2 world) {
|
||||
if (world == null) throw new IllegalArgumentException("world cannot be null.");
|
||||
return parent == null ? world : parent.worldToLocal(world);
|
||||
}
|
||||
|
||||
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
||||
public Vector2 parentToWorld (Vector2 world) {
|
||||
if (world == null) throw new IllegalArgumentException("world cannot be null.");
|
||||
return parent == null ? world : parent.localToWorld(world);
|
||||
}
|
||||
|
||||
/** Transforms a world rotation to a local rotation. */
|
||||
public float worldToLocalRotation (float worldRotation) {
|
||||
worldRotation *= degRad;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user