mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
Added Rigidbody.DOPath/DOLocalPath methods (beware: they don't work on windows phone/store)
This commit is contained in:
parent
5f28d4bba8
commit
8cabb36ec1
@ -1416,6 +1416,34 @@
|
|||||||
<param name="duration">The duration of the tween</param>
|
<param name="duration">The duration of the tween</param>
|
||||||
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
|
<param name="path">The waypoints to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
|
<param name="path">The waypoint to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1416,6 +1416,34 @@
|
|||||||
<param name="duration">The duration of the tween</param>
|
<param name="duration">The duration of the tween</param>
|
||||||
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
|
<param name="path">The waypoints to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
|
<param name="path">The waypoint to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1416,6 +1416,34 @@
|
|||||||
<param name="duration">The duration of the tween</param>
|
<param name="duration">The duration of the tween</param>
|
||||||
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
|
<param name="path">The waypoints to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
|
<param name="path">The waypoint to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,15 +1,15 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 815d51dc93583bf41877ee87d4904f12
|
guid: 815d51dc93583bf41877ee87d4904f12
|
||||||
timeCreated: 1452683148
|
timeCreated: 1482512619
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 4
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 1
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
correctGamma: 0
|
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
borderMipMap: 0
|
borderMipMap: 0
|
||||||
mipMapFadeDistanceStart: 1
|
mipMapFadeDistanceStart: 1
|
||||||
@ -21,23 +21,19 @@ TextureImporter:
|
|||||||
normalMapFilter: 0
|
normalMapFilter: 0
|
||||||
isReadable: 0
|
isReadable: 0
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 0
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
cubemapConvolutionSteps: 7
|
|
||||||
cubemapConvolutionExponent: 1.5
|
|
||||||
seamlessCubemap: 0
|
seamlessCubemap: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
textureSettings:
|
textureSettings:
|
||||||
filterMode: -1
|
filterMode: 0
|
||||||
aniso: -1
|
aniso: 1
|
||||||
mipBias: -1
|
mipBias: -1
|
||||||
wrapMode: -1
|
wrapMode: 1
|
||||||
nPOTScale: 1
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
rGBM: 0
|
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
spriteMode: 0
|
spriteMode: 0
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
@ -45,10 +41,25 @@ TextureImporter:
|
|||||||
spritePivot: {x: 0.5, y: 0.5}
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
spritePixelsToUnits: 100
|
spritePixelsToUnits: 100
|
||||||
alphaIsTransparency: 0
|
alphaUsage: 1
|
||||||
textureType: -1
|
alphaIsTransparency: 1
|
||||||
buildTargetSettings: []
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 16
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
outline: []
|
outline: []
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
|
|||||||
Binary file not shown.
27
UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange02.cs
Normal file
27
UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange02.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using DG.Tweening;
|
||||||
|
|
||||||
|
public class IndexOutOfRange02 : BrainBase
|
||||||
|
{
|
||||||
|
public Transform[] targets;
|
||||||
|
|
||||||
|
IEnumerator Start()
|
||||||
|
{
|
||||||
|
DOTween.Init (true, false, LogBehaviour.ErrorsOnly).SetCapacity (1000, 100);
|
||||||
|
DOTween.defaultAutoPlay = AutoPlay.None;
|
||||||
|
DOTween.defaultAutoKill = false;
|
||||||
|
yield return new WaitForSeconds(1);
|
||||||
|
|
||||||
|
foreach (Transform t in targets) t.DOMoveX(10, 10).Play();
|
||||||
|
yield return new WaitForSeconds(2);
|
||||||
|
|
||||||
|
// DOTween.Clear(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
DOTween.Clear(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 54fb7137f3cb9e8438aa924bd4007c49
|
||||||
|
timeCreated: 1481284579
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange02.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/Bugs/IndexOutOfRange02.unity
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d91cc58d8594d7f4595ddd71ef53e32d
|
||||||
|
timeCreated: 1481284574
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -5,16 +5,31 @@ using System.Collections;
|
|||||||
public class PathsFree : BrainBase
|
public class PathsFree : BrainBase
|
||||||
{
|
{
|
||||||
public Transform target;
|
public Transform target;
|
||||||
|
public bool useRigidbody;
|
||||||
|
public bool useLocalPosition;
|
||||||
|
public float duration = 3;
|
||||||
public Ease ease = Ease.Linear;
|
public Ease ease = Ease.Linear;
|
||||||
public PathType pathType;
|
public PathType pathType;
|
||||||
public bool closePath;
|
public bool closePath;
|
||||||
public Vector3[] waypoints;
|
public Vector3[] waypoints;
|
||||||
|
|
||||||
IEnumerator Start()
|
void Start()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(1);
|
Tween t;
|
||||||
|
if (useLocalPosition) {
|
||||||
target.DOPath(waypoints, 3f, pathType).SetOptions(closePath).SetEase(ease)
|
t = useRigidbody
|
||||||
|
? target.GetComponent<Rigidbody>().DOLocalPath(waypoints, duration, pathType).SetOptions(closePath).SetLookAt(0.001f)
|
||||||
|
: target.DOLocalPath(waypoints, duration, pathType).SetOptions(closePath).SetLookAt(0.001f);
|
||||||
|
} else {
|
||||||
|
t = useRigidbody
|
||||||
|
? target.GetComponent<Rigidbody>().DOPath(waypoints, duration, pathType).SetOptions(closePath).SetLookAt(0.001f)
|
||||||
|
: target.DOPath(waypoints, duration, pathType).SetOptions(closePath).SetLookAt(0.001f);
|
||||||
|
}
|
||||||
|
t.SetEase(ease)
|
||||||
.OnWaypointChange(x=> Debug.Log("CHANGE > " + x + " - " + target.position));
|
.OnWaypointChange(x=> Debug.Log("CHANGE > " + x + " - " + target.position));
|
||||||
|
if (useRigidbody && !target.GetComponent<Rigidbody>().isKinematic) {
|
||||||
|
t.OnPlay(()=> target.GetComponent<Rigidbody>().isKinematic = true);
|
||||||
|
t.OnComplete(()=> target.GetComponent<Rigidbody>().isKinematic = false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -32,7 +32,7 @@ namespace DG.Tweening
|
|||||||
public class DOTween
|
public class DOTween
|
||||||
{
|
{
|
||||||
/// <summary>DOTween's version</summary>
|
/// <summary>DOTween's version</summary>
|
||||||
public static readonly string Version = "1.1.520";
|
public static readonly string Version = "1.1.530";
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
@ -30,6 +30,7 @@ namespace DG.Tweening.Plugins.Options
|
|||||||
public Quaternion forward;
|
public Quaternion forward;
|
||||||
public bool useLocalPosition;
|
public bool useLocalPosition;
|
||||||
public Transform parent; // Only used with OrientType.ToPath and useLocalPosition set as TRUE
|
public Transform parent; // Only used with OrientType.ToPath and useLocalPosition set as TRUE
|
||||||
|
public bool isRigidbody;
|
||||||
|
|
||||||
internal Quaternion startupRot; // Used to reset orientation when rewinding
|
internal Quaternion startupRot; // Used to reset orientation when rewinding
|
||||||
internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently
|
internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace DG.Tweening.Plugins
|
|||||||
// then sets the final path version
|
// then sets the final path version
|
||||||
public override void SetChangeValue(TweenerCore<Vector3, Path, PathOptions> t)
|
public override void SetChangeValue(TweenerCore<Vector3, Path, PathOptions> t)
|
||||||
{
|
{
|
||||||
Transform trans = (Transform)t.target;
|
Transform trans = ((Component)t.target).transform;
|
||||||
if (t.plugOptions.orientType == OrientType.ToPath && t.plugOptions.useLocalPosition) t.plugOptions.parent = trans.parent;
|
if (t.plugOptions.orientType == OrientType.ToPath && t.plugOptions.useLocalPosition) t.plugOptions.parent = trans.parent;
|
||||||
|
|
||||||
if (t.endValue.isFinalized) {
|
if (t.endValue.isFinalized) {
|
||||||
@ -137,7 +137,7 @@ namespace DG.Tweening.Plugins
|
|||||||
// Public so it can be called by GotoWaypoint
|
// Public so it can be called by GotoWaypoint
|
||||||
public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos, UpdateNotice updateNotice)
|
public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos, UpdateNotice updateNotice)
|
||||||
{
|
{
|
||||||
Transform trans = (Transform)t.target;
|
Transform trans = ((Component)t.target).transform;
|
||||||
Quaternion newRot = Quaternion.identity;
|
Quaternion newRot = Quaternion.identity;
|
||||||
|
|
||||||
if (updateNotice == UpdateNotice.RewindStep) {
|
if (updateNotice == UpdateNotice.RewindStep) {
|
||||||
@ -216,7 +216,8 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.hasCustomForwardDirection) newRot *= options.forward;
|
if (options.hasCustomForwardDirection) newRot *= options.forward;
|
||||||
trans.rotation = newRot;
|
if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot;
|
||||||
|
else trans.rotation = newRot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ namespace DG.Tweening
|
|||||||
public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
||||||
{
|
{
|
||||||
#if COMPATIBLE
|
#if COMPATIBLE
|
||||||
TweenerCore<QuaternionWrapper, Vector3Wrapper, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), endValue, duration);
|
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), endValue, duration);
|
||||||
#else
|
#else
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
#endif
|
#endif
|
||||||
@ -421,7 +421,7 @@ namespace DG.Tweening
|
|||||||
public static Tweener DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
public static Tweener DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
||||||
{
|
{
|
||||||
#if COMPATIBLE
|
#if COMPATIBLE
|
||||||
TweenerCore<QuaternionWrapper, Vector3Wrapper, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), towards, duration)
|
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), towards, duration)
|
||||||
#else
|
#else
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
||||||
#endif
|
#endif
|
||||||
@ -480,11 +480,89 @@ namespace DG.Tweening
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
/// <summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
||||||
|
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
||||||
|
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
|
/// <param name="path">The waypoints to go through</param>
|
||||||
|
/// <param name="duration">The duration of the tween</param>
|
||||||
|
/// <param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
||||||
|
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
|
||||||
|
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (resolution < 1) resolution = 1;
|
||||||
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, new Path(pathType, path, resolution, gizmoColor), duration)
|
||||||
|
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
||||||
|
|
||||||
#endregion
|
t.plugOptions.isRigidbody = true;
|
||||||
|
t.plugOptions.mode = pathMode;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
/// <summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
|
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
||||||
|
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
|
/// <param name="path">The waypoint to go through</param>
|
||||||
|
/// <param name="duration">The duration of the tween</param>
|
||||||
|
/// <param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
||||||
|
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
|
||||||
|
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (resolution < 1) resolution = 1;
|
||||||
|
Transform trans = target.transform;
|
||||||
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path, resolution, gizmoColor), duration)
|
||||||
|
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
||||||
|
|
||||||
#region TrailRenderer Shortcuts
|
t.plugOptions.isRigidbody = true;
|
||||||
|
t.plugOptions.mode = pathMode;
|
||||||
|
t.plugOptions.useLocalPosition = true;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
|
||||||
|
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
||||||
|
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
||||||
|
)
|
||||||
|
{
|
||||||
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, path, duration)
|
||||||
|
.SetTarget(target);
|
||||||
|
|
||||||
|
t.plugOptions.isRigidbody = true;
|
||||||
|
t.plugOptions.mode = pathMode;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
||||||
|
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Transform trans = target.transform;
|
||||||
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
|
||||||
|
.SetTarget(target);
|
||||||
|
|
||||||
|
t.plugOptions.isRigidbody = true;
|
||||||
|
t.plugOptions.mode = pathMode;
|
||||||
|
t.plugOptions.useLocalPosition = true;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region TrailRenderer Shortcuts
|
||||||
|
|
||||||
/// <summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
/// <summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
/// Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
@ -513,9 +591,9 @@ namespace DG.Tweening
|
|||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Transform Shortcuts
|
#region Transform Shortcuts
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's position to the given value.
|
/// <summary>Tweens a Transform's position to the given value.
|
||||||
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
|
||||||
@ -826,7 +904,7 @@ namespace DG.Tweening
|
|||||||
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
|
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Special
|
#region Special
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis.
|
/// <summary>Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis.
|
||||||
/// Returns a Sequence instead of a Tweener.
|
/// Returns a Sequence instead of a Tweener.
|
||||||
@ -965,13 +1043,13 @@ namespace DG.Tweening
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Blendables
|
#region Blendables
|
||||||
|
|
||||||
#region Light
|
#region Light
|
||||||
|
|
||||||
/// <summary>Tweens a Light's color to the given value,
|
/// <summary>Tweens a Light's color to the given value,
|
||||||
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
|
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
@ -994,9 +1072,9 @@ namespace DG.Tweening
|
|||||||
.Blendable().SetTarget(target);
|
.Blendable().SetTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Material
|
#region Material
|
||||||
|
|
||||||
/// <summary>Tweens a Material's color to the given value,
|
/// <summary>Tweens a Material's color to the given value,
|
||||||
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
|
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
@ -1046,9 +1124,9 @@ namespace DG.Tweening
|
|||||||
.Blendable().SetTarget(target);
|
.Blendable().SetTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Transform
|
#region Transform
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
|
/// <summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
|
||||||
/// in a way that allows other DOBlendableMove tweens to work together on the same target,
|
/// in a way that allows other DOBlendableMove tweens to work together on the same target,
|
||||||
@ -1158,14 +1236,14 @@ namespace DG.Tweening
|
|||||||
.Blendable().SetTarget(target);
|
.Blendable().SetTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// ===================================================================================
|
// ===================================================================================
|
||||||
// OPERATION SHORTCUTS ---------------------------------------------------------------
|
// OPERATION SHORTCUTS ---------------------------------------------------------------
|
||||||
|
|
||||||
#region Operation Shortcuts
|
#region Operation Shortcuts
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Completes all tweens that have this target as a reference
|
/// Completes all tweens that have this target as a reference
|
||||||
@ -1411,6 +1489,6 @@ namespace DG.Tweening
|
|||||||
return DOTween.TogglePause(target);
|
return DOTween.TogglePause(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1416,6 +1416,34 @@
|
|||||||
<param name="duration">The duration of the tween</param>
|
<param name="duration">The duration of the tween</param>
|
||||||
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
|
<param name="path">The waypoints to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalPath(UnityEngine.Rigidbody,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
|
||||||
|
<summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
|
Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
||||||
|
<para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
|
<para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
|
If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
|
<param name="path">The waypoint to go through</param>
|
||||||
|
<param name="duration">The duration of the tween</param>
|
||||||
|
<param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
|
||||||
|
<param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
|
<param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
||||||
|
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
|
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user