playMaker

Author Topic: Getting movement vector based on character's movement?  (Read 2519 times)

PlayingKarrde

  • Playmaker Newbie
  • *
  • Posts: 4
Getting movement vector based on character's movement?
« on: December 29, 2014, 12:49:04 AM »
Hi all,

I'm having a problem that I was wondering if someone could help me with.

My situation is I'm creating a third person fighting game where the camera is (relatively) static and two players can move freely in the world. I want both characters to face each other at all times as they move.

This much is simple - I'm just using the Controller Move and Smooth Look At actions for the two. The problem now is that I want to send the movement direction of the character to it's Animator Controller so the animations are correct. Normally I would send in the H and V from the Get Axis Vector, but this is camera relative, not Character relative, so I'm not entirely sure how I should do this.

My initial thought was to do another Get Axis Vector but this time relative to the player (or target) but this doesn't return any value it seems. So I was thinking I would try and get the vector the character is moving in and use that.

Any help is appreciated. I'm new to Playmaker and so this is all fairly new to me.

Thanks.

PlayingKarrde

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Getting movement vector based on character's movement?
« Reply #1 on: December 29, 2014, 12:52:22 AM »
Ugh I'm so stupid. Turns out my initial idea of doing two Get Axis Vectors does work it just wasn't returning anything since the multiplier was set to none...  :-[

However I'm still not getting the results I need. When the character is above or below the focus it seems to work fine, but when the character is situated to the left or right the numbers appear reversed (ie the animation for walking forwards is playing while moving backwards and vice versa).

So close...
« Last Edit: December 29, 2014, 01:13:06 AM by PlayingKarrde »

PlayingKarrde

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Getting movement vector based on character's movement?
« Reply #2 on: December 29, 2014, 05:54:17 AM »
I'm really confused by this. It's as if the horizontal axis is getting flipped only when the character is rotated around 90 or 270 degrees. I can't work it out.

Here is my FSM and where I feel the problem area lies.


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Getting movement vector based on character's movement?
« Reply #3 on: December 30, 2014, 02:38:22 PM »
I'm curious, what does the actual picture above actually produce for results?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

PlayingKarrde

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Getting movement vector based on character's movement?
« Reply #4 on: December 30, 2014, 04:35:46 PM »
So this is the bizarre thing, it works fine if the character is on the Z axis in relation to the focus, but is reversed if it is on the X axis. So for example if the character is below (or really "in front") of the focused character moving towards it will produce a positive number and away a negative one. Now if the player moves to the side of the player moving towards the player produces a negative number and away positive.

I ended up doing it in C# instead but it's still puzzling why this occurs like this.