Build 772 update broke some gimmicks with StandardAssets
chiugame
I made a gimmick that can get player's bottom collider position with the FirstPersonController and FollowTarget scripts of StandardAssets, but it doesn't work anymore since build 772. It still works in the Unity editor though.
Reproduce:
wrld_87213d88-a1b6-4520-aa30-acd91703f981
StandardAssets required.
- Press the button at the center.
- Then the capsule should be left side, the cube's position, at least they are in the Unity editor or before build 772, but now you'd see it at right side.
Japanese:
StandardAssetsのFirstPersonControllerとFollowTargetを使用して足元のコライダーの位置を取得するギミックを作りました。
しかしながらBuild 772にて正しく動作しなくなりました。
UnityEditor上では正常に動作します。
再現:
wrld_87213d88-a1b6-4520-aa30-acd91703f981
StandardAssetsが必要
・ワールドに入って正面にあるボタンを押します。
・UnityEditor・Build 772以前であればCapsuleは左にあるCubeの位置に移動していましたが、現在は右にあるままです。
Log In
Cap․
[March 10,2019]As players approach, the booth activates.
[May 19,2019]The player is approaching but the booth is not activated.
wrld_5dd6e1c9-486d-4918-b77d-c1684268bcf3
naqtn
To clarify the problem, let me explain the issue.
To seek ground collider position, this gimmick uses Raycast embedded in FirstPersonController component and moves "character object" with CharacterController.
In reproducing scene, you can see a game object named "CharacterController" has CharacterController, FollowTarget and FirstPersonController components. (And also FirstPersonController requires AudioSource. ) These components are disabled at initial state. When user presses the button, it does following process:
- FirstPersonController.Start() : Initialize FirstPersonController component.
- CharacterController.enable = true : Enables CharacterController to allow FirstPersonController move "CharacterController" object via CharacterController.
- FollowTarget.LateUpdate() : Before using Raycast, move "CharacterController" object to "FollowPos" where we want to know ground position. (Details below *3)
- FirstPersonController.FixedUpdate() : Move "CharacterController" object to ground level. (Details below *4)
- CharacterController.enable = false : Stop farther character movement process.
(*3 FollowTarget's offset property is set to zero. So "CharacterController" moves to "FollowPos". "FollowPos" should be placed enough above from the ground.)
(*4 Usually FirstPersonController.FixedUpdate is called by game loop and it moves the character object along user input direction. In this gimmick, the Button calls it once to move character. WalkSpeed and RunSpeed properties are set to zero, GravityMultiplier and StickToGroundForce are set to large value 999999. So, FirstPersonController calculates as movement direction is going down. And it calls CharacterController.Move method, then the character object "CharacterController" falls to ground immediately.)
This is how this gimmick works.
With build 772, "CharacterController" moves to the ground. But it falls from initial position, not from "FollowPos" position.
Falling down means that the character movement mechanism by FirstPersonController and CharacterController basically works.
At first sight, it seems FollowTarget doesn't work simply. But FollowTarget works fine solely. You can check it by removing step 4 FirstPersonController.FixedUpdate. This time "CharacterController" object moves to "FollowPos" correctly.
I guess build 772 changes something about character location origin relating its movement. It seems calling CharacterController.enable property accessor saves the transform internally and uses it in Move method. not using current transform value.
Anyway, this gimmick works fine in Unity Editor as usually expected. If it's difficult to fix, please disclose how Standard Asset components behave differently in VRChat runtime.