playMaker

Author Topic: Move Towards not Working, any Alternatives?  (Read 1971 times)

patheticorganic

  • Playmaker Newbie
  • *
  • Posts: 11
Move Towards not Working, any Alternatives?
« on: August 03, 2021, 05:38:40 AM »
I have a gameobject with a character controller component, it also has its camera as a child of it. I've set up movement using Get Axis, and feeding that into a Controller Move action. Speed variable is simply the multiplier for the Axes.

What I want to do is make the character move fast towards an object that it has thrown, basically like:

Click -> Object is thrown -> Object detects walls, sticks to them -> Click again -> Move towards the object quickly -> Object is reparented to player and throwing action can be done again.

My go-to was the Move To action, which didn't work. This in and of itself has boggled me for a while in other projects, but in those I just found another alternative. This time, however, the alternative didn't work as planned. Move To also doesn't really take physics into account, so it would feel less like a "launch" and more like I'm flying towards the target object and then immediately losing momentum when I touch it.

I went on this tangent of using vectors, making the camera look at the object and calculating its direction through that and then changing my speed variable so that the character launches itself in the direction the camera is facing... It works, albeit extremely sub-optimally and messy. I know there should be a simpler way to do this.

I'm not that new to Unity and Playmaker, but there are some concepts and ideas that I could be missing to troubleshoot this.

In short, I'm trying to catapult my player towards an object.

Any help at all is appreciated. Thank you in advance.
« Last Edit: August 03, 2021, 05:45:46 AM by patheticorganic »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Move Towards not Working, any Alternatives?
« Reply #1 on: August 04, 2021, 01:25:44 AM »
It sounds like some grappling hook mechanic or something, right?

Have you tried move towards with tweening the speed with a custom curve? Might work out ok.

I guess you want a kind of slingshot physics feel without using physics, right?
Available for Playmaker work

patheticorganic

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Move Towards not Working, any Alternatives?
« Reply #2 on: August 15, 2021, 03:56:10 AM »
Sorry for the late reply, I was not at home.

It's less of a grappling hook mechanic and a really fast dash towards wherever the object landed. I pretty much just need the player to go in a straight line towards the object, but not teleport as I want collisions and triggers to be active as I move towards the object.

I want the movement to be physics based as well - I figured the player could try to use the dash as a slingshot if they wanted to, I don't want to restrict movement too much. Move Towards doesn't really achieve this but I was using it to test the movement and it just didn't work.

I think what I need to do is try to find a way to lock the player towards the direction of the object, putting velocity/speed on the player, and launching it directly towards the object. I've tried different methods but it's probably a lot simpler than I think it is.

It sounds like some grappling hook mechanic or something, right?

Have you tried move towards with tweening the speed with a custom curve? Might work out ok.

I guess you want a kind of slingshot physics feel without using physics, right?

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Move Towards not Working, any Alternatives?
« Reply #3 on: August 16, 2021, 06:57:56 AM »
I was gonna propose translate, but if you want it physics based, that goes off, as well as rigidbody.moveposition.

Have you tried adding force?
Available for Playmaker work

patheticorganic

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Move Towards not Working, any Alternatives?
« Reply #4 on: August 21, 2021, 04:02:32 AM »
The issue here is not with the adding of velocity/force, but rather, I simply don't know how to add that force in the direction of where the object I threw landed, basically how to forcefully turn the character toward the object and launch them in a straight line only towards the direction where the object landed.

I'm not extremely familiar with how vectors and things of the sort can be used properly, which I assume is what I need to understand to get this working. Do you have any recommended resources to help me understand what I can do with them? I feel bad having to rely on the forums only every time I have an issue...

But in short, the launching of the player is solved. I just have to find a way to direct them towards the object specifically, in a straight line.
 

I was gonna propose translate, but if you want it physics based, that goes off, as well as rigidbody.moveposition.

Have you tried adding force?

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Move Towards not Working, any Alternatives?
« Reply #5 on: August 25, 2021, 03:49:51 PM »
Try googling something like unity grappling gun and see what pops out on youtube, probably cam find something helpful.
Available for Playmaker work