I’m at a loss. I’m just trying to track some changes to a property when I press the X button. The properties in the remote inspector are changing, but I don’t understand this behavior. If there is anything I’m missing please let me know. If you need more information about the project please just ask me and I’ll update the question.
This is inside an _Input function.
case JoyButton.X:
Ref.Paddles.Top.Location = Loc.Left;
Ref.Paddles.Right.Location = Loc.Top;
Ref.Paddles.Bottom.Location = Loc.Right;
Ref.Paddles.Left.Location = Loc.Bottom;
Deb.Print(
Ref.Paddles.Top.Name + ":" + Ref.Paddles.Top.Location + " HashCode: " + ((RigidBody3D)Ref.Paddles.Top).GetHashCode(),
Ref.Paddles.Right.Name + ":" + Ref.Paddles.Right.Location + " HashCode: " + ((RigidBody3D)Ref.Paddles.Right).GetHashCode(),
Ref.Paddles.Bottom.Name + ":" + Ref.Paddles.Bottom.Location + " HashCode: " + ((RigidBody3D)Ref.Paddles.Bottom).GetHashCode(),
Ref.Paddles.Left.Name + ":" + Ref.Paddles.Left.Location + " HashCode: " + ((RigidBody3D)Ref.Paddles.Left).GetHashCode()
);
After pressing the X button and setting the properties… the Location never changes.
As you can see I’m printing out the HashCode but it doesn’t match the inspector, and I’m not even sure I’m doing this Hash check correctly. The paddle names are just the initial general placement relative to the camera. The first time X is pressed the Location property updates (as it is initialized to Direction.Top) to Direction.Left, but afterward it never updates.
This is the “Left” paddle.
This is the Deb.Print output.
:0 - Top:Left HashCode: 35259143, Right:Top HashCode: 37418306, Bottom:Right HashCode: 10983950, Left:Bottom HashCode: 17284754
:0 - Top:Left HashCode: 35259143, Right:Top HashCode: 37418306, Bottom:Right HashCode: 10983950, Left:Bottom HashCode: 17284754
:0 - Top:Left HashCode: 35259143, Right:Top HashCode: 37418306, Bottom:Right HashCode: 10983950, Left:Bottom HashCode: 17284754
:0 - Top:Left HashCode: 35259143, Right:Top HashCode: 37418306, Bottom:Right HashCode: 10983950, Left:Bottom HashCode: 17284754
:0 - Top:Left HashCode: 35259143, Right:Top HashCode: 37418306, Bottom:Right HashCode: 10983950, Left:Bottom HashCode: 17284754
:0 - Top:Left HashCode: 35259143, Right:Top HashCode: 37418306, Bottom:Right HashCode: 10983950, Left:Bottom HashCode: 17284754
The Ref.cs holds paddles like so…
[Export]
public PackedScene PaddlesScene;
public static Paddles Paddles;
...
//paddles
Paddles = (Paddles)PaddlesScene.Instantiate();
AddChild(Paddles);
PaddlesScene = null;
And the Paddle.Init() looks like this…
public partial class Paddle : RigidBody3D {
...
public void Init(
string location,
Vector3 startPosition,
Vector3 startRotation,
float speed
) {
Attach = GetNode<MeshInstance3D>("Attach");
Attach.Position = Vec.Forward(this);
Node3D Model = GetNode<Node3D>("Model");
Collider = GetNode<CollisionShape3D>("Collider");
_startPosition = startPosition;
Position = startPosition;
Rotation = new Vector3(
Mathf.DegToRad(startRotation.X),
Mathf.DegToRad(startRotation.Y),
Mathf.DegToRad(startRotation.Z)
);
Speed = speed;
Resizer.Rect(Model, Collider, Model.Scale);
GravityScale = 0;
Location = location;
Name = location;
}