playMaker

Author Topic: Get height (Y only) of an object and move to that height [SOLVED]  (Read 3175 times)

sandEboy

  • Playmaker Newbie
  • *
  • Posts: 39
    • GraspTech
I've set triggers on the edge of objects for climbing. I need the player to snap to the height of those edges, ignoring the other positions of the object such as the X and Z.

I tried get, set position but the player also moves to the X and Z position, not the height alone (Y).

Any suggestions?
« Last Edit: April 15, 2016, 10:55:24 AM by sandEboy »

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: Get height (Y only) of an object and move to that height.
« Reply #1 on: April 14, 2016, 10:57:56 AM »
Use "Get Position" on the climbable object. Instead of storing it as a Vector, you only need to store the "Y" Value as a float.

Then you can use "Set Position" on the player, only entering the "Y" Float value.

sandEboy

  • Playmaker Newbie
  • *
  • Posts: 39
    • GraspTech
Re: Get height (Y only) of an object and move to that height.
« Reply #2 on: April 14, 2016, 11:45:44 AM »
Thanks I'll try it out and see what happens.

sandEboy

  • Playmaker Newbie
  • *
  • Posts: 39
    • GraspTech
Re: Get height (Y only) of an object and move to that height.
« Reply #3 on: April 14, 2016, 02:26:25 PM »
Well it works, but now the play needs to snap a little distance forward to remain on top of the object. The problem is that when I set it to also snap to Z at about 0.5 hoping the player will move forward. It snaps to definite 0.5 position on in the world. I tried setting it to self space but it still does the same. Is the script broken?

sandEboy

  • Playmaker Newbie
  • *
  • Posts: 39
    • GraspTech
Re: Get height (Y only) of an object and move to that height.
« Reply #4 on: April 14, 2016, 03:10:07 PM »
I had the self and world space confused there a little. Anyways, basically what I want is to position the player to a specific height in relation to the edge. So I'm trying to get the information on the edge's height and from there add some adjustment to the player in relation to this height.

I used a get trigger info in order to store the edge object in a variable and use that variable as the target for positioning the player.

Using set position I managed to get the player to snap to the object, but he needs an additional Y axis adjustment to get him at just the right position.

I tried adding another set position action with the hopes of just adjusting the Y by adding whatever value is needed there, but when I test it. Instead of snapping to that position relative to the edge... he snaps to the definite position in the world.

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: Get height (Y only) of an object and move to that height.
« Reply #5 on: April 15, 2016, 06:56:43 AM »
Just as an idea from the top of my head:

Get the world space Y and Z position of edge into seperate float variables.

Use Float operator to add adjustment to the floats (so for example if you need The player to be to the lower left of the edge's centre: subtract (for example) 0.2 from the Z float and subtract (eg.) 0.5 from the Y float. You will need to play around with the positions until you find the right figure to add/subtract to the floats in order for the player to be in the right position).

Then set the world space position on player to the Y and Z floats you just adjusted.

Im a noob and this is of the top of my head, but I hope it helps.

(edit to add:) Also there is a tutorial that appears to be dealing with what seems like an identical/simmilar feature, that may be useful to you: (I have not watched this episode)

Good luck with it and let us know how it goes!
« Last Edit: April 15, 2016, 07:02:32 AM by Zeldag »

sandEboy

  • Playmaker Newbie
  • *
  • Posts: 39
    • GraspTech
Re: Get height (Y only) of an object and move to that height.
« Reply #6 on: April 15, 2016, 10:52:43 AM »
Thank you Chizzler and Zeldag. I got it working perfectly. This is an insane climbing system. Basically I used the float add and subtract functions to make the necessary adjustment to position the character on the ledge to climb, at the end I then did the same to position the character at the perfect position on top of the ledge. To get the forward movement so as to stay on top of the objects, I used translate. Big thanks.

sandEboy

  • Playmaker Newbie
  • *
  • Posts: 39
    • GraspTech
Re: Get height (Y only) of an object and move to that height.
« Reply #7 on: April 15, 2016, 10:53:59 AM »
I'm new here so I'm wondering if I should modify the heading top add [SOLVED] ?

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: Get height (Y only) of an object and move to that height [SOLVED]
« Reply #8 on: April 15, 2016, 11:24:52 AM »
Wow it worked!  ;D lol I was expecting it to work generally, but still really good to hear it helped in your specific situation.