MerlinVR / UdonSharp

An experimental compiler for compiling C# to Udon assembly
MIT License
678 stars 89 forks source link

WheelCollider.GetWorldPose(out position, out rotation) not working correctly #16

Closed jzody closed 4 years ago

jzody commented 4 years ago

It seems to return both values as null.

Here is a code example:


using UdonSharp;
using UnityEngine;

public class Example : UdonSharpBehaviour
{
    public WheelCollider Wheel;
    public GameObject VisualWheel;

    void Update()
    {
        Wheel.motorTorque = 1000;

        Vector3 position;
        Quaternion rotation;

        Wheel.GetWorldPose(out position, out rotation);

        VisualWheel.transform.position = position;
        VisualWheel.transform.rotation = rotation;
    }
}
jzody commented 4 years ago

I've ran a test that shows this isn't a Udonsharp issue. It seems to be related to the Quaternion.toAxis issue depicted in the readme, because both functions seem to use output parameters. I've added this test to the Canny.io issue.

Maybe it's helpful to change the readme to change the Quaternion.toAxis, but add a warning/disclaimer on functions with out parameters? image

MerlinVR commented 4 years ago

Thanks, the readme already has a warning about other functions with multiple out parameters potentially not functioning due to the Udon bug. I haven't run into any issues with functions that have a single out parameter.

jzody commented 4 years ago

I don't know why I've read over that, but thank you for your time!