|
|
|
 |
Reply From: |
johnygames |
You could simply rotate the object programmatically without making it a child. Let’s say you want an object called “Satelite” to copy the rotation of another object called “Planet”. You open a script, get a referemce to both objects and write under the _process()
function:
Satelite.rotation = Planet.rotation
Will this do the trick, or do you need anything more complicated?
I’m not looking for a copy of a rotation, more so a type of anchor point for the rotation of the satellite.
The script you wrote would make them sit in one place and rotate at the rate.
I’m more in need of having something like; a movable planet that doesn’t effect the transform of a satellite, but the satellite will always orbit based off of the position of the planet. Does that make sense?
In this post we have discussed how a Position2D
node can be used as that anchor point you are talking about. Have the Position2D
copy the planet’s rotation using the code provided above. Then make the satellite a child of the Position2D
(not a child of the planet).
As the planet moves away, the Position2D
will stay in place. When the planet spins, so does the Position2D
. Since the satellite is now a child to the Position2D
, it will copy its rotation. The thing is that if the satellite and the Position2D
have the same center point, they will just pivot around it. But: if the satellite is offset, its rotation will become an orbital motion around the Position2D
. Isn’t this the desired effect?
johnygames | 2019-12-30 20:47
Not exactly. Sorry that I’m not explaining it well enough.
So, I have two nodes: A and B.
I want A to be able to translate
wherever I need it to go, without effecting B.
I want to then be able to rotate B around A, as if A was the B-nodes anchor point.
My thought process behind the logic is that if node A was a parent
of node B, but I can some how mitigated the translation
and scale
properties of node A. It should give me the desired effect. This way whenever I manipulate the rotation
of the node, it would rotate node B around the parent node A, based off the distance between them.
But I am open to other ways of achieving this.
I also have this question, do you find any solution to this?
Constannnnnt | 2020-07-07 17:38