Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jprocha101

Pages: [1]
1
I am trying to make an object shake every time the user clicks the mouse. It's an fps time game and the object is the cross hairs. I want then to shake.

I can do it programmatically but have issues using the visual editor. I am probably not rsetting the tween or killing it or something like that.

2
Then how come if I enter .1,1 the object is moved back to the world position of the first time the shake tween was executed?

3
DOTween & DOTween Pro / Re: DOPunchPosition modifies z-position
« on: July 18, 2015, 10:11:27 PM »
Chain an OnComplete to set it back to the original value.

this.tweener = this.transform.DOPunchPosition(targetPos, 0.2f, distance, 1, false).OnComplete(()=>this.transform. position = monstPos);

4
I am using ShakePosition via the visual editor. Is there a way to make the movement relative?

I know I can use SetRelative() if I do it all through code, but I want to start taking advantage of the visual editor since it is faster to tweak the values.

Thanks

5
DOTween & DOTween Pro / Re: Setup DOTween doesn't finish
« on: June 21, 2015, 10:08:01 AM »
That is odd, I just tried it and it worked. I have the same versions of DOTween and Unity. Have you tried it on fresh project? Maybe the new version of Unity, DOTween, and another asset you have don't play nice together.

6
DOTween & DOTween Pro / Re: DOLookAt in 2D
« on: June 21, 2015, 10:05:20 AM »
Have you tried it yet with a rigidbody attached though?  From the DOTween doco:

Rigidbody
These shortcuts use rigidbody's MovePosition/MoveRotation methods in the background, to correctly animate things related to physics objects.


If you're worried about physics making your objects fall about, make sure to check Is Kinemetic true in the rigidbody settings.

The other thing I would suggest is making sure your Z value in the "towards" Vector3 is the same as that of the plane on which your object is sitting.

@cynicalwanderer 
Thank you for helping me out. I was able to use Rotate instead. I just calculated the rotation using Mathf.Atan2 and did the tween using that result. I found some other people using other assets and those asset's version of LookAt and they all seem to have issues with 2D. It ends up rotating on 2 axis at some point, usually when the target is directly above or below the rotating object. But 2D should (usually) rotate along the z-axis only.  8)

public void GoToPoint(Vector3 targetPos)
    {
        transform.DOKill();

        var dir = targetPos - transform.position;
        var angle = Mathf.Atan2(dir.y, dir.x)*Mathf.Rad2Deg;
        var rot = Quaternion.AngleAxis(angle, Vector3.forward);

        transform.DORotate(rot.eulerAngles, 100).SetEase(Ease.Linear).SetSpeedBased()
            .OnComplete(() => transform.DOMove(targetPos, 10).SetEase(Ease.Linear).SetSpeedBased());
    }

7
DOTween & DOTween Pro / DOLookAt in 2D
« on: June 19, 2015, 10:48:41 AM »
Hello, maybe an expert can help me out.  :o

I am trying to get DOLookAt to work in 2D, I tried a bunch of combinations but cannot get it to work. I have a gun turret in a top down shooter type game and it is placed at the very bottom of the screen. There is gun barrel on the turret pointing to the top of the screen. When the user clicks on the screen I would like the turret to rotate on the Z axis and point towards where the user clicked, so it looks like the gun will shoot in that direction. I am using the transform for the rotation, there no rigidbody attached to the object, not sure if that matters.

I am not sure which parameter values to enter to get this to work, the constraints seem to work on all but the Z axis which is messing up a 2D view. I have attached an example of what the screen looks like and drew the x axis and y axis.


8
DOTween & DOTween Pro / Re: Spamming DOPunch translation offsets
« on: June 15, 2015, 07:20:12 PM »
I had the same issue. To remedy it I added an OnComplete method to the DOPunch tween to reset the transform to its original scale.

I do believe this is a bug, and DOTween should handle the scenario without additional coding from us :D

9
That worked! Thank you very much.

A different issue though, I seem to only be able to execute the tween one time each. Then calling it a second time does nothing. I deactivated auto kill but it still did not work. Do you see anything wrong with the component setup?

Thanks!

10
Maybe someone can help me out when using DOTween Pro with Unity 5 and uGUI :).

I have a standard unity panel in the center of my screen (not full screen width/height, using it as a pause menu popup) and I have an anchor point in each corner of the panel. With that setup the panel scales to the device screen when I build and run the application on my android device. I set a way point to move the panel off screen on application start and then it slides back on screen when user presses the pause button.

It all works fantastic in the editor, but on my android device it looks as though the anchor positions did not stay in the original positions and the panel is skewed off to one side, so much that it is barely visible on the screen. If I remove the DOTween component the panel is visible on the center of the device, just like in the editor. Please see attachments.

Pages: [1]