playMaker

Author Topic: Get Angular Velocity broken?  (Read 2706 times)

Grendelbiter

  • Playmaker Newbie
  • *
  • Posts: 11
Get Angular Velocity broken?
« on: April 19, 2017, 09:14:15 AM »
I have a character with a rigidbody driven by a navmesh agent. I want to get rotation speed so I can set animations. I have an FSM on the character with the rb, just one state with Get Angular Velocity for now and debug turned on. None of the values change when I move my character.

Grendelbiter

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Get Angular Velocity broken?
« Reply #1 on: April 20, 2017, 08:21:21 AM »
I should maybe mention that this is a generated UMA character. I've tried all kinds of methods to get my character animated with no success. Why are there no Tutorials for that? It seems like half the questions here are about moving characters.

Whie poking around I found an action called Nav Mesh Agent Animator synchronizer. I put it in an FSM of it's own but nothing happens. Can someone explain how to use this action?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Get Angular Velocity broken?
« Reply #2 on: April 20, 2017, 10:28:17 AM »
Hi,
I can't test at the moment, but probably you object is not rotating by force.

Try by using "Set Angular Velocity" to the object en then use "Get Angular Velocity"
then you can see if it works.

I am not sure how to calculate the rotating speed if it is not by force, i will do some testing when i get home.

Grendelbiter

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Get Angular Velocity broken?
« Reply #3 on: April 20, 2017, 12:10:39 PM »
Thanks for your reply. I almost got it working. I'm trying to recreate the script from the navmesh mecanim movement examples. My character is running now only turning too slow but I have an idea how to fix it.

Grendelbiter

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Get Angular Velocity broken?
« Reply #4 on: April 20, 2017, 02:24:21 PM »
I think I found a bug. I'm trying to Get Property desiredVelocity.item from the navmesh agent and unity is piling up these errors:

Code: [Select]
TargetParameterCountException: parameters do not match signature
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:188)
System.Reflection.MonoProperty.GetValue (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:297)
System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:283)
HutongGames.PlayMaker.ReflectionUtils.GetMemberValue (System.Reflection.MemberInfo member, System.Object target) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ReflectionUtils.cs:304)
Rethrow as ArgumentException: MemberInfo has index parameters
Parameter name: member
HutongGames.PlayMaker.ReflectionUtils.GetMemberValue (System.Reflection.MemberInfo member, System.Object target) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ReflectionUtils.cs:308)
HutongGames.PlayMaker.ReflectionUtils.GetMemberValue (System.Reflection.MemberInfo[] memberInfo, System.Object target) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ReflectionUtils.cs:285)
HutongGames.PlayMaker.FsmProperty.GetValue () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmProperty.cs:419)
HutongGames.PlayMaker.Actions.GetProperty.OnUpdate () (at Assets/PlayMaker/Actions/GetProperty.cs:36)
HutongGames.PlayMaker.FsmState.OnUpdate () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:256)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2618)
HutongGames.PlayMaker.Fsm.Update () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1865)
PlayMakerFSM.Update () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:509)

shouldn't .item be a vector3, not a float?

Edit: also, am I guessing right that .item would be the same as typing out agent.desiredVelocity?
« Last Edit: April 20, 2017, 02:28:41 PM by Grendelbiter »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Angular Velocity broken?
« Reply #5 on: April 26, 2017, 03:58:14 AM »
Hi,

 yes, you are right, something is odd with this Unity property, Unfortunatly, I don't think anything is possible on our end for this since Unity doesn't expose it properly, if you check for example .DEstination, it exposes "vector3" properly.

 Also, I strongly advice to get the pathfinding package from the Ecosystem and use the dedicated actions for it, there is one to get the desiredVelocity.



Bye,

 Jean