0 votes

I'm trying to use C++ with Godot and face a problem.

struct CharacterInterpolatedData
    static const CharacterInterpolatedData IDENTITY;
    CharacterInterpolatedData(Vector3 p_position, Quat p_orientation);
    CharacterInterpolatedData(const CharacterInterpolatedData &p_other);

    CharacterInterpolatedData linear_interpolate(const CharacterInterpolatedData &p_to, float p_percent);
    bool operator==(const CharacterInterpolatedData &p_other);
    bool operator!=(const CharacterInterpolatedData &p_other);

    Vector3 Position;
    Quat Orientation;

 rset("m_interpolatedData", m_interpolatedData);

it complained that no suitable convention from CharacterInterpolatedData to Variant. How can I achieve what I want? I means cast CharacterInterpolatedData to Variant.

Godot version 3.3.2
in Engine by (67 points)

1 Answer

0 votes

You can't. Except maybe to dump your whole struct to buffer like PoolXXXArray, or simply pass your Vector3 and Quat separately.

But can you tell what a practical usage of packing it to Variant are you implying?
Otherwise it sounds like XY-problem..

by (1,594 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.