|
Post by nitrox32 on Jun 7, 2020 17:45:47 GMT
Can I not use root motion with the new inventory system? When I do I get the following reoccurring error when I open the inventory screen:
rigidbody.velocity assign attempt for 'vMeleeController_Elgar' is not valid. Input velocity is { NaN, -0.000004, NaN }. UnityEngine.Rigidbody:set_velocity(Vector3) Invector.vCharacterController.vThirdPersonMotor:MoveCharacter(Vector3) (at Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/vThirdPersonMotor.cs:480) Invector.vCharacterController.vThirdPersonController:ControlAnimatorRootMotion() (at Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/vThirdPersonController.cs:43) Invector.vCharacterController.vThirdPersonInput:OnAnimatorMove() (at Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/vThirdPersonInput.cs:191)
They stop when I close the inventory screen.
|
|
|
Post by hobbycoder on Jun 11, 2020 7:01:09 GMT
just disable root motion everytime you open the inventory
|
|
|
Post by uberwiggett on Jun 11, 2020 10:54:45 GMT
It is to do with the preview model and how the input locks when the inventory opens. It doesn't affect the game much but it is annoying. If you look, it is saying the input is going into a negative value which the system doesn't like. It is something that seemed to pop up mostly in unity 2019, not sure if it happens on earlier versions.
|
|
|
Post by darkrurik on Jul 16, 2020 7:19:05 GMT
vThirdPersonMotor.cs
public virtual void MoveCharacter(Vector3 _direction)
if (useVerticalVelocity)
{
if (float.IsNaN(targetVelocity.x))
{
targetVelocity.x = 0f;
}
if (float.IsNaN(targetVelocity.y))
{
targetVelocity.y = 0f;
}
if (float.IsNaN(targetVelocity.z))
{
targetVelocity.z = 0f;
}
targetVelocity.y = _rigidbody.velocity.y;
_rigidbody.velocity = targetVelocity;
}
|
|
|
Post by manwitch on Aug 24, 2020 18:57:40 GMT
I have this problem using unity 2019.4.8f1, this code doesn't seem to work for me.
I can't say for sure but when I run a build it loads then crashes 2 seconds after starting, this is the only error I have happening so I was thinking it might be the problem. But I am not positive that this error is what's causing it.
Any suggestions?
|
|
|
Post by manwitch on Aug 25, 2020 14:31:30 GMT
So I went back to NOT using root motion. It gets rid of this error. I would like to use the root motion though so @hobbycoder Easiest way to disable on entering inventory? and re-enable when leaving it?
I've looked through to see if there was a way to use events but I am striking out.
|
|
|
Post by manwitch on Sept 2, 2020 19:56:03 GMT
Any one willing to point me in the right direction? I've tried every thing in my capabilities and no luck.
Even just point me to which script to edit?
I've tried different things in vItemManager and Vthirdpersoncontroller and motor.cs's but I am really stuck on this one
ETA- I solved the build crashing problem, it didn't have anything to do with this error.
But I still haven't managed to solve this issue.
|
|
|
Post by Invector on Sept 3, 2020 13:41:23 GMT
Any one willing to point me in the right direction? I've tried every thing in my capabilities and no luck. Even just point me to which script to edit? I've tried different things in vItemManager and Vthirdpersoncontroller and motor.cs's but I am really stuck on this one ETA- I solved the build crashing problem, it didn't have anything to do with this error. But I still haven't managed to solve this issue. A quick solution would be to open vThirdPersonMotor script go to the method MoveCharacter() and replace all the Time.deltaTime and Time.fixedDeltaTime to vTime.deltaTime and vTime.fixedDeltaTime But that kind of experimental, please test and post the feedback if you have any issues.
|
|
|
Post by manwitch on Sept 3, 2020 17:06:45 GMT
Any one willing to point me in the right direction? I've tried every thing in my capabilities and no luck. Even just point me to which script to edit? I've tried different things in vItemManager and Vthirdpersoncontroller and motor.cs's but I am really stuck on this one ETA- I solved the build crashing problem, it didn't have anything to do with this error. But I still haven't managed to solve this issue. A quick solution would be to open vThirdPersonMotor script go to the method MoveCharacter() and replace all the Time.deltaTime and Time.fixedDeltaTime to vTime.deltaTime and vTime.fixedDeltaTime But that kind of experimental, please test and post the feedback if you have any issues. This worked with no issues , I only quickly tested it, but everything seems to work fine after playing in editor and going into and out of inventory. No errors or adverse effects that I found. I'm going to run another build to test and I'll post if any thing else comes up, but I think this is a fine fix. Thank you for all you do! much appreciated. (I'm going out of town for some beach time so it might be several days before I can post again)
|
|
void
New vMember
Posts: 1
|
Post by void on Oct 7, 2020 14:45:01 GMT
I think the easiest way to handle this and keeping inline with invectors scripts would be just to add an event and disable root motion (which hobbycoder mentioned). I know i'm a little late to the party but just in case anyone runs into this issue or any issues with replacing timedelta.
Open up script cThirdPersonMotor.cs. I threw mine under the Locomotion region. Here are 2 functions you could use.
Create a void function with a bool parameter for rootMotion. Assign the public variable "useRootMotion" to the value of your bool parameter. Go back to your editor, under Inventory_UI-> script Master Window. add to Enabled events your vThirdPersonController.UseRootMotion as false (unchecked) and on Disable same thing but true (Checked).
Or just make a toggle for it. Same script area just change your function to not pass in a parameter. If statement or a ternary is usually what I do. This time open up Inventory->V Inventory script, under events->On Open Close Inventory(Boolean) throw in your toggle.
Set them to virtual if you want to override this at one point. EXAMPLE 1 public virtual void UseRootMotion(bool rootMotion) { useRootMotion = rootMotion; } EXAMPLE2 public virtual void UseRootMotion() { useRootMotion = useRootMotion ? useRootMotion = false : useRootMotion = true; } Hopefully that helps anyone.
|
|