playMaker

Author Topic: Normalize Vector[SOLVED]  (Read 3145 times)

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Normalize Vector[SOLVED]
« on: February 26, 2019, 04:53:12 PM »
Hello,

I have no problem doing this in the code but I just want to replicate this only using PM.

Here is the reference of what I am trying to do by the end of it.


The problem I am having is Vector normalize part. I am able to do all of it except making sure that my vector is normalized so that I move in all directions at the same speed.

In addition, I have added animations such as Idle, Walk and Run just to test. My character will move faster when holding two buttons and will also animate a bit faster.

So, I have 0.5 for walk and 1.0 for run. When holding two buttons (because normalize does not kick in) it will be set to 0.7.

P.S. I have also tried to do this with vector lamp in PM.

Any help would be appreciate it.

Thanks!
« Last Edit: March 05, 2019, 08:41:36 AM by jeanfabre »

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: Normalize Vector
« Reply #1 on: February 26, 2019, 05:03:45 PM »
Would also love to know about this... its an issue I've put off for a while... xD

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #2 on: February 26, 2019, 05:16:55 PM »
Good to know I am not the only one. I thought maybe I do not know what I am doing. Do you think it is a bug that they need to fix?

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: Normalize Vector
« Reply #3 on: February 26, 2019, 06:41:18 PM »
I don't think its a bug, mainly because I know that it happens outside of this use case so much :)

I do remember seeing this post a while back, perhaps it will help:
http://hutonggames.com/playmakerforum/index.php?topic=5439.0

I remember being confused about the clamped magnitude option and not testing it, but sounds like it does?

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #4 on: February 26, 2019, 06:56:33 PM »
I was able to figure out how to clamp it and it works but here is the problem. My "walkSpeed" will stop working when I use normalize. So, then my animations with have sliding foot because I cannot adjust the speed of my player movement (I am not using root motion btw). Animator Set Speed does not work eaither (it does work but results are not what I am after).

I will look at this link. Thanks!

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #5 on: February 26, 2019, 08:00:38 PM »
So, does anyone know how to use normalize and still be able not to use root motion and get non-sliding foot effect (explained previously)?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Normalize Vector
« Reply #6 on: February 28, 2019, 01:45:49 AM »
Hi,

 ok, I don't see in this video anything undoable with PlayMaker, so I guess your problem might simply be that you are not doing the right series of actions to get the same results.

I face this problem very often, and the best way to approach this is to make sure values are separated, so you need to maintain more variables just to be able to validate their respective values at each stage.

 so like he did in his script, make sure you have a variable Input, and a variable InputDir and debug this.

 also, are you sure you have designed the mecanim setup properly, if your setup is wrong then it will corrupt the final behaviour.

for this, simply switch from the script he's mentioned and your playmaker fsm(s), and the behaviour must be identical.

Are you confortable with scripting? or ok enough to recreate that behaviour as explained in the video? if not, I can do that for you so that you have a frame of reference to validate that indeed it's in your fsm that things go wrong.

Bye,

 Jean


appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #7 on: February 28, 2019, 11:58:49 AM »
Hello,

I am OK with the script itself. I am just trying to replicate it in FSM. I managed to do what I wanted to do but now the issue is that I cannot get third person camera.

I need Get Axis Vector and then set Main Camera under "Relative To". Then I do camera FSM. However, I do not know how to do what I just did using pure Get Axis but rather with Get Axis Vector .

I will include a picture with this so you can see what I have. Now, how do I set TPC using this. I have tested the Smooth Follow Target, Smooth Look At and Move Towards. This will work with Get Axis Vector but not with pure Get Axis.

P.S. I am NOT parenting my main camera to the character. I want to replicate the video itself.

Thanks!
« Last Edit: February 28, 2019, 12:00:21 PM by appTester4587 »

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #8 on: February 28, 2019, 06:46:32 PM »
Hello,

I have managed to solve the issue with most of the things. What I am running into is when player is moving (in any direction) it jitters. I am using Character Move. Anyone know what could cause it?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Normalize Vector
« Reply #9 on: March 01, 2019, 04:21:18 AM »
Hi,

 jitter is usually because the camer movement is done within Update and should be done within LateUpdate.

how are you moving the camera? Or is it  case where camera is not moving but the player itself is jittery?

Bye,

 Jean

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #10 on: March 01, 2019, 07:49:20 AM »
Hello,

I do not have option for Update/Late Update but just a checkbox for "Every Frame". I know some have option for Update and Late Update. I managed to reduce the jitters a bit (but not completely) by increasing Move Towards' "Speed".

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #11 on: March 01, 2019, 08:49:33 AM »
One more thing that I do not understand. I just watched 10 different tutorials on TP Controller. To make it long story short every one of them was able to get gravity working on character controller by just simply adding Character Controller. I tried with Character Move (not simple move) with Character Controller and have tried just CC without CM and I did not get gravity. The only way to get gravity is by adding it (I set it in different FSM). Why is that?

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #12 on: March 01, 2019, 10:05:16 AM »
Is this msg normal or...?

Failed to update assembly 'Assets/Plugins/PlayMaker/Metro/PlayMaker.dll': Assembly reference folder does not exist: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.6\'.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Normalize Vector
« Reply #13 on: March 04, 2019, 11:53:15 PM »
Hi,

 Can you open a new thread for this issue on 4.6 and dll, so that a thread don't mix up topics, thanks :)

Did you update Unity versions before this issue or switched build platform? usually if you reimport PlayMaker it should set itself rights and to force Unity to properly deal with that dll.

Bye,

 Jean

appTester4587

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Normalize Vector
« Reply #14 on: March 05, 2019, 07:44:16 AM »
I was on the latest version of Unity at that time (2018.3.6f1). It is fine now.

I had to install NetFx_PortableLibraryReferenceAssemblies46 and install it in the folder specified in that msg (manually). After that I did not get any errors.

Please close this tread.

Thanks!