I’ve got a scene with some instantiated rigidbody cubes with a script attached to the cube in its scene. I’ve made all the parts unique and local to scene which did help but they still aren’t truly separate. For example, when I delete one of them all of them lose their physics. And when calculating their rotation if one cube moves it changes the rotation for every cube. How would I go about fixing this and getting all the instances to be separate, and is there a way to do that while having the cubes use the same script or do you have to do some extra shenanigans to make it work?
That shouldn’t happen, unless you’re executing these commands directly within the script - then all Nodes that have that script attached will be affected by it.
We can’t really judge anything without seeing your script and the relevant scene structure.
I am executing the commands within the script attached to the cube. I have a scene set up with some cubes instantiated and they’re all under a Node3D parent like this:
I’m just testing stuff right now and in the script attached directly to the cube scene I’m trying to find the rotation of the selected cube and apply a force to it upon pressing a button. Each cube can be clicked on and when clicking on one it’ll be marked as selected. The code looks like this:
Whenever the force is applied on the selected cube its rotation will effect every other selected cube and cause the force to applied incorrectly. This also happened when trying to simply delete the selected cube earlier where deleting one would keep the other cubes present but their physics would be removed.
How should I go about scripting this stuff so that each cube instance behaves the same but doesn’t effect each other?
Thanks in advance!