All joints return Node3D type when referenced in code
Xacorman opened this issue · comments
Tested with all joints.
If you add a jolt joint to a scene and manually assign the nodes it works as expected but if you attempt to get a reference to it in code Godot returns an error of not being able to cast Node3D to the joint type.
Generic6DofJoint3D foo;
public override void _Ready()
{
foo = GetNode<Generic6DofJoint3D>("bar");
}
object System.Runtime.CompilerServices.CastHelpers.ChkCastAny(System.Void*, object): System.InvalidCastException: Unable to cast object of type 'Godot.Node3D' to type 'Godot.Generic6DofJoint3D'.
Installed via Godot AssetLibrary and followed installation steps listed
I'm guessing you're adding a JoltGeneric6DOFJoint
to the scene? The substitute joints (JoltGeneric6DOFJoint
, JoltHingeJoint3D
, etc.) can't be used from C# in that way, unfortunately. See #632.
You'll need to use the regular Generic6DOFJoint
instead, which uses Jolt as well.