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 - picklesandtickles

Pages: [1]
Playmaker Help / Re: AddForce2D to Target World Position
« on: February 03, 2018, 06:42:21 PM »
Hello again,

I'm writing to let you know of the solution I found to this. I used your advice, Jean, but the only way I could get it to work right was to essentially calculate the slope of the line between the player and the target. I used the target position for x1 and y1, then said if x2 was x1 multiplied by a force factor, what would y2 be. It was easy to figure out the slope and position of x2 and y2 from there.

Aside from working through the slope equation using variables, I also had to apply Impulse rather than Force. It just gave better results considering what I was looking to achieve.

Oh, and finally, I had to increase iterations in the Physics 2D Settings, to keep the hinge joints from separating so much when the force was applied. All of that combined gave a nice result. See attached for a quick look at the FSM.

Here's a quick video of the force being applied. I need to tweak the force factor just a bit, but It's nearly there:

Thanks so much for your help with this. I really appreciate the Playmaker community!!!

Playmaker Help / Re: AddForce2D to Target World Position
« on: January 26, 2018, 07:01:23 AM »
Wait wait wait.... I just looked at my screenshots again. I actually think my gbl_target_world_position and Object position are the same thing.

In #2, I'm getting mouse position, but saving it as Object position, then subtracting the target world position from the object position, which doesn't make sense then.

I'm at work now, but I'll tweak it when I get home later to actually pull the Object position, rather than the mouse position, and I'll see what happens.

Playmaker Help / Re: AddForce2D to Target World Position
« on: January 26, 2018, 05:26:58 AM »
Hello Jean,

Thanks for your reply. I tried what you recommended, but I may be missing a step. The force is applied in the same direction each time, despite mouse position. Here's my setup in three simple steps:

If you could take a look, I'd greatly appreciate it.

Playmaker Help / Re: AddForce2D to Target World Position
« on: January 23, 2018, 04:32:49 PM »

Using a no gravity test scene, I was able to experiment with Add Force 2D and move an object towards the mouse. Thanks for your help with that!!!

My last question related to this is how do you put a lot more force behind the object, but in the same direction?

Basically, I can get force to be added at a vector2 or vector3, but it doesn't do much, even with reduced gravity and object mass. How would you recommend increasing force in the same direction?

Playmaker Help / Re: AddForce2D to Target World Position
« on: January 23, 2018, 09:33:03 AM »
Hello Jean,

Thanks for the quick response and good advice. I will start with the basics and build from there. I'll come back to post my results when I get it working with the gravity and connected joints.

Thanks again.

Playmaker Help / [SOLVED] AddForce2D to Target World Position
« on: January 22, 2018, 05:40:27 PM »

I'm having trouble with AddForce2D. I apply force towards a vector3, which I have set to a position in the World, but the object receiving the force moves in the same direction every time.

The Target position is wherever the mouse clicks, and that part works fine (Attached Position Target). I use a global variable for the position in the world and call it when applying force to the hand object (Fire Right Hand attachment).

Unfortunately, wherever I click on the screen, the force is applied in the same direction each time. See a quick video here:

Perhaps I'm just using AddForce2D incorrectly. Any help is greatly appreciated.

Awesome - thanks for setting it up and creating the gif!! I was able to quickly replicate it exactly, and it worked as advertised. :)

I'm hoping you can provide one more piece of advice related to this question. (edit: if you'd rather me just mark this as solved and open the question below in a new thread, I'd be happy to do that.)

I'd like it to constantly detect whether or not the Target object is moving towards or away from the Player object. To this end, I created a bool to store the left click followed by a bool test set to every frame.

When I do this, the Distance Manager seems to be constantly working as I move the target around the screen, but the distance that it detects seems to be more random. Can you think of a better way to set up the constant detection while dragging? Here's a video where you can see the behavior in the FSM:

Thanks again for your help.


Thanks for the quick response. I moved some things around and tried your suggestion. Here's what I've got:

The first picture shows what happens during play. The fsm constantly loops back around to the start, I think because it detects that lastDistance and currentDistance are equal.

Something strange, though, is that I threw in a Debug.Log to see if I could get the distance to at least show up in the console and it didn't print. Not quite sure why.

I stumbled across "Get Last Pointer Data Info" in Ecosystem. Could it be used to accomplish why I want? It has bools for "Is Pointer Moving," "Dragging," and "World Position." Maybe I can use this to accomplish something similar. If the target object is being dragged toward the player then X. If it is being dragged away from the player then Y. Any ideas around that?

Thanks again for your input.

Edit: Interestingly, the distance does show up in the Scene, as you can see in the attached picture, so I know that part is working.

Playmaker Help / How to detect if distance is increasing or decreasing
« on: January 14, 2018, 10:23:17 AM »

What's the best way to detect if the distance between two objects is increasing or decreasing?

The idea I have is to take distance at time 1 distance at time 2, then subtract distance 1 from distance 2. If the result is positive, the target object is moving away from the player. If the result is negative, the target object is moving toward the player.

The result determines which event is sent next. I'm working on a script to do this, but I'm pretty new at C#, so I wanted to get your ideas first. Any advice is appreciated.

Edit: I'm messing around with Float Operator, Float Compare, and Float Sign Test, but I can't seem to get them to function with the two Get World Distance variables I've created.

Playmaker Help / Re: Object appear at mouse position
« on: January 13, 2018, 10:42:28 AM »

This question has been solved. Thank you! I used the Ecosystem Sample Move Towards With Constraints as a model. I was able to replicate the states, events, and actions from that sample within my own scene. Doing so causes the Target object to appear wherever there is a mouse click on the screen. No I can use that as a basis for some more complex interactions. Thanks again for your input!

Playmaker Help / Re: Object appear at mouse position
« on: January 12, 2018, 07:07:40 AM »
Hi guys,

Thanks to both of you for the suggestions - I will give them a try today and will stop back by later with an update. Jean - I hadn't tried MoveTowardsWithConstraint, but I will definitely give that and Move Towards a try to see the varying results. Thanks again. Stay tuned.

Playmaker Help / [SOLVED] Object appear at mouse position
« on: January 11, 2018, 02:59:53 PM »
Hi All,

I'm trying to create a situation where click on the screen makes an object on the screen appear where the mouse clicked. Right now, I can only get the object to move in little increments. This is for a 2D game. Here's what I have in Playmaker:

Left Click, Store Mouse Position, Move Character

The object "Click and Move" is an Empty object whose child is the Ball Sprite. It's a normal 2D object. I set the X,Y,Z to be 0 for both the empty object and the ball sprite. Thanks for any help you can provide.

Playmaker Help / Issue with Mouse Pick 2D and multiple joints
« on: January 07, 2018, 07:59:33 PM »
Hello Playmaker Community,

Bottom line up front: I'm having an issue where most of the player's hinge joints fall apart and the movement becomes erratic when I try to run the FSM included in my Input Manager object with Move Towards action. Here's a demo with the FSM first enabled, and then disabled:

Now for some context: 

I'm working on a 2D game involving a player composed of sprites hooked together with multiple hinge joints (think "Mount Your Friends"). With Playmaker, I'd like to be able to click and drag anywhere on the scene, and have the central body of the player move in the opposite direction of the mouse.

In other words, when I click above the player's head and drag down, I'd like the body to move up toward the mouse, keeping all hinge joints (connecting arms and legs) connected while it moves.

Before I do all that, though, I just want to get some basics down. I've walked through a couple tutorials and read the documentation on Pick Mouse and Pick Mouse 2D to get the mouse position and set it as a target toward which the body of the player moves, but as you can see from the video above, I'm running into some serious problems.

Any recommendations for easier ways to do this with Playmaker, or if not, areas within my setup where I can troubleshoot? Let me know if you need additional information to help diagnose. Thanks!

Pages: [1]