[Solved] Change position of a rotating object put around another object?

hello I have an object (plantturret) that rotates towards the player at increment angles but when I put plantturret around another object (plantrotate) to change the plantturret position this happens between increments?

example
animation

events

Those can’t be all the events - where are the events that sets the angle of plantturret?

the top actions is what sets the angle [actions] rotate plantturrent toward player then change angle set to increments. the events not shown are more angles.

Heh, I didn’t see that first line - the image had scrolled up on my PC and was hidden off the top :smiley:

What’s the angle that’s causing the jittering?

when the players position is between the increments of 22.5 degrees. example plantturrent is rotating towards player position changing angle from 180 to 157.5 if the players position is between 179 to 158 plantturret keeps changing between 180 and 157.5 continuously. the issue happens when plantturret is put around plantrotate (small square object in the centre)

I’m wondering if it’s either one of the other angles you’ve got (not on the screen snip) is conflicting with the ones in the screen snip? Or another event that uses a slightly different method/values to calculate the angle?

But my main query is why, in the first event of the screen snip, you rotate the plantturret, then set the angle. Why not just set the plantturret angle to be round(the angle from plantturret to player/22.5)*22.5?

And then the same for plant. Rather than put plant around plantturret twice (first in the first event, then in the angle event), why not just set the angle in the first events?

Though I don’t think those last two questions will make a difference.

hello rather than attempt to explain I figured would be easy to upload the file with the assets. I set the angles as a test and doesn’t have all the angles yet. I know that it has to do with putting plantturret around another object plantrotate the problem occurs. basically I want plantturret to rotate and move position but this causes the issue. the reason I put around another object is because the plant will be constantly moving along x position. as for why I used a sperate object in place of the plantturret was because plant has animation frames at different 22.5 degrees if I rotate the object the animation angles don’t look right when rotated.

Do you rotate then move plantturret? If so, have you tried it the other way round - moving the turret then rotating it?

my thinking was I need a centre object for platnturret to position itself around and then I can move plantrotate along x position at a constant speed.

Is this what you’re after?

PVZtest

I just changed these event actions :

2 Likes

yes you have fixed the problem and works perfectly as I wanted thanks for your help. I didn’t know the correct syntax I wouldn’t have figured that out.

1 Like