Rotate and follow
saad1993
Member, BASIC Posts: 47
Hello. So I've been able to make actor B rotate around actor A using the cos and sin formula, thanks to the brilliant forum help. What I can't figure out, or find in the forums, is how to make actor B rotate around and follow actor A.
So if actor A moves up and down, actor B should move with it while still rotating around actor A. Currently, actor B just spawns near actor A and rotates around it, but when I move it, actor B remains in the fixed position and keeps rotating.
Appreciate the help!
Comments
Simply add actor A's position to actor B's position.
Does that make sense ?
Makes perfect sense. I did that by adding the X and Y positions of actor A into constrain attribute rules of actor B, along with the cos and sin formula. But it doesn't work.
Could it be because actor A's X position is constrained to a certain value and can only move up and down? Could it be because actor A can be moved with a touch and slide input?
No, that would have no effect on the maths, can you share a screenshot of your code for actor A and B ?
Example attached:
Same thing, but you drag actor A with the mouse:
You're using the formula you showed on the instance of the rotating character. I want to be able to make all prototypes of the rotating character behave in that way. This is because the character will be destroyed and re-attained by the movable character (Character A). For Character A, all I have is a constrain attribute to broadcast the positions of it's X and Y as a game attribute.
Kind of lost with this.
I'm not sure what this means, I've not shown any formula ?
How many prototypes of the rotating character do you have ?
I'm not sure what the question is ? What is it - specifically - that is preventing you from doing what you need to do ?
In the gamesalad file you sent, you're using the constrain attribute behavior on the instance of actor B, not on prototypes.
Technically, unlimited, since it is an endless game.
The problem is that actor B rotates in a fixed spot after spawning in the position where actor B is. It does not move with actor A, it just keeps rotating at that spot. I require it to move with actor A, while rotating around actor A.
Like I say above, simply add actor A's position to actor B's position, it really is as simple as that ! I'm actually still not sure what the issue is ? By that I don't mean that I don't know what the question is, I mean that the answer has been given and I'm not sure what the issue is with implementing it ?
Make sure you don't have "do not move" ticked within the actors attributes! Worth a shot!
If by don't have "do not move" ticked you mean do have "movable" ticked then that won't effect anything as Constrain behaviours are outside of the physics engine, so "movable" has no effect on how they work.
Ah cool, hope this guy gets it sorted, yeah I couldn't remember what it was actually called, just browsing the forums while in my work commute train