playMaker

Author Topic: How to limit an object's movement range in Playmaker (or in Unity)[SLOVED]  (Read 3182 times)

playmakertester

  • Full Member
  • ***
  • Posts: 211
Hi,

I'm now trying to copy color bumper 3D as playmaker test

Watching the play video, it looks like the ball swings from side to side, but doesn't move beyond a certain point.

I came up with the following method to implement this.

#1 Placing a wall on either side
#2 Set the maximum value of left and right movements

As for #1, I couldn't solve the problem of the ball going through the wall when I moved it quickly.

For #2, I'm wondering if it would be better to set the maximum value of the variable in Playmaker, but I don't know how to set the maximum value of the variable.

Is there any way to limit the movement of the ball as shown in the video?

Thank you for your help.
« Last Edit: October 29, 2020, 07:15:15 AM by playmakertester »

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #1 on: August 05, 2020, 06:51:51 AM »
a {Float clamp} action might do it. ;D

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #2 on: August 05, 2020, 07:54:48 AM »
Hi 3dambit,

Thanks, playmaker master!

I'll try the {Float clamp} action here.
https://hutonggames.com/playmakerforum/index.php?topic=11518.0

If I can't understand it, let consult with me again.

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #3 on: August 05, 2020, 08:16:30 AM »
Hi,

I followed this article to set it up.
(I'm developing this feature as a continuation of "How To Move 3D Object With Touch Dragging Finger by Playmaker" which was answered.)

I set up

Get Position
→ Get VectorXYZ
→ Float Clamp

as shown in the picture, but the X of the transform exceeds 4,-4.

If you can tell me what is wrong, I would appreciate it.

https://imgur.com/a/7JNkTve

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #4 on: August 05, 2020, 10:51:33 AM »
Hi.
you should set the clamp on the DeltaX
Also The sequence of your actions are important.

1st set the Get Mouse Delta Position,
Then Float Clamp,
Then Translate.

On you image is only changing the ShooterPositionX 'Variable' Value.
So you could add a "Set Position" 'after' the Float Clamp (below)
And use the ShooterPositionX to set the value.
But better to try what i wrote above.

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #5 on: August 05, 2020, 01:08:28 PM »
Hi Hero djaydino,

I just changed as screen shot.

on Inspector, actually, DeltaX is limited -4 to 4.
https://imgur.com/a/uJirKTX

But Object is move beyond the range specified by Float Clamp. :o
Please let me know if you have any good solutions :)

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #6 on: August 05, 2020, 05:03:51 PM »
Here's a way to make it work.
Get mouse delta position, store as variable. [Movement]
Translate this variable
Get position, in my case i wanted the x axis, store as variable [Xpos]

Now you use 2{float compare} actions.

One for less than, one for greater than. Set whatever values you want in float 2 of each action.

I have attached a screenshot, hopefully it will help.

I can probably explain this better.I have it working with my game anyway.




playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #7 on: August 06, 2020, 01:41:03 AM »
Hi 3dambit,

Thanks for detail!

Can I ask what "State 3" action is doing?

Best,

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #8 on: August 06, 2020, 03:56:57 AM »
I forgot to put that picture up sorry. please find attached now.

State 3 basically lets you move again after hitting the wall.
I made this a year ago so i was having trouble remembering.

Hope that helps

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #9 on: August 06, 2020, 06:48:41 AM »
Hi 3dambit, djaydino,

It wored! Thanks lot.

I would like to renovate the Product to make it more complete.

The object to be moved transforms the mouse's input, but if you move the mouse quickly to the left or right, it may exceed the threshold.

How can I make it so that the threshold is not exceeded even if the mouse is moved quickly?

If you have any good ideas, I'd appreciate it if you could let me know.

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #10 on: August 06, 2020, 10:12:51 AM »
To be precise, the object behaves as if it crosses the threshold for a moment and then returns to the threshold.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #11 on: August 06, 2020, 12:11:07 PM »
Hi.
Instead of moving the ball directly you can move a empty object,
Then Let the ball 'Smooth follow' that object

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #12 on: August 06, 2020, 12:41:35 PM »
Hi djaydino,

It works perfect!

Thanks everyone!

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to limit an object's movement range in Playmaker (or in Unity)
« Reply #13 on: August 06, 2020, 04:13:27 PM »
If you are happy that we have answered the questions you asked, could you mark them as [SOLVED]  .It will help when people are looking for these answers again. Here's a thread about it
https://hutonggames.com/playmakerforum/index.php?topic=133.0

Thanks

playmakertester

  • Full Member
  • ***
  • Posts: 211
Hi 3dambit,

>If you are happy that we have answered the questions you asked, could you mark them as [SOLVED]
Sure, I got it!

Smooth follow and it worked the way I wanted it to. However, I noticed that even this sometimes caused the object to move faster than expected.

What actions should be added to make the ball follow the mouse's movement with a slight time difference? If you have any advice, I would appreciate it.