Topic was automatically imported from the old Question2Answer platform.
Asked By
Multirious
When using tween, passing dictionary value path as "physical_property:rotation" works fine
But when I’m trying to pass this onto get(), instead they return null.
var val = object.get("physical_property:rotation")
This is a function that supposes to get value from another node.
What’s the right nodepath for dictionary value?
I can do a workaround with get("physical_property")["rotation"] but the thing is that the code and passing argument would get more complicated since some properties are not contained in dictionary and will need to pass more arguments than neccessary.
get_node_and_resource() is close to getting what you want but I think you would either need to dynamically generate the NodePath at runtime or hard code it - which probably isn’t what you want.
I think you are doing the most straightforward method of getting what you want but I could just be naive of a function.
Haven’t tried this yet, but why is passing "physical_property:rotation" in Tween works? I thought Tween would using the same setget function.
Yeah, tried using get_node_and_resource and it’s not working It does return the node and the remaining path but it does not return any property, it’s just null.
Multirious | 2021-07-06 10:24
It’s possible you’re not forming the NodePath right or something. I would just stick to using get("physical_property")["rotation"] like you were doing.
timothybrentwood | 2021-07-06 16:51
Yeah, I decided to do this and putting every single variable in a dictionary instead.