ctceismc said: What exactly is distance in the new solution? Distance from what to what?
Distance is calculated by: magnitude(self.offsetX,self.offsetY).
To translate Rob2's suggestion into GameSalad would be: self.position.x = game.sceneX+magnitude(self.offsetX ,self.offsetY)*cos( self.Rotation ) self.position.y = game.sceneY+magnitude(self.offsetX ,self.offsetY)*sin( self.Rotation )
(If I have misunderstood what Rob2 was suggesting. Then I'd like see what was meant.)
Its basically the same approach. Except it swaps the cosine and sine functions and it lops off the arc-tangent subtractions.
Basically, these equations are for getting objects to orbit around a point -- and/or to describe a circle. Unfortunately, I haven't been able to use them to rotate off-center. The Y always evaluates to zero. I spent some time trying to get it to work. I tried all sorts of permutations of those equations -- but while they're great for getting things to orbit, I haven't been able to get them to work for off-centered rotations. Whenever I do come up with a winning solution, it just ends up being functionally equivalent to the original equations. (But I'd be happy to be proven wrong! I am all for shorter, more direct solutions.)
hmm came in her hoping to get an answer to how i could rotate an actor from the side on touch. i want to be able to move en actor by taping one side or the other and make it move left or right depending on which side was touched.
Mcreator83 said: hmm came in her hoping to get an answer to how i could rotate an actor from the side on touch. i want to be able to move en actor by taping one side or the other and make it move left or right depending on which side was touched.
to bad you can't rotate it from other than 0
But you can! Just follow the directions in the very first post. You can get the actor to rotate around any point on or off the actor.
Nice job here. I got something similar working a while ago, but I only got it to spin around a corner, and I never quite figured out how to fine tune the offset to your liking. I tip my hat to you, good sir.
Asymptoteell said: Nice job here. I got something similar working a while ago, but I only got it to spin around a corner, and I never quite figured out how to fine tune the offset to your liking. I tip my hat to you, good sir.
Hey Thanks! It was actually your rotate from corner demo that provided the impetus to figure this out. But in all honesty, I did not come up with the equations. I just got really frustrated and started plugging in search terms into google. I found something that looked useable with GameSalad on a web site for a different platform (which I now cant find again). I just got lucky....
RThurman said: But you can! Just follow the directions in the very first post. You can get the actor to rotate around any point on or off the actor.
ok i got that working but it only moves around one point, i can't make it move around in the scene depending on the ground or objects in the scene as well as gravity.
Mcreator83 said: ok i got that working but it only moves around one point, i can't make it move around in the scene depending on the ground or objects in the scene as well as gravity.
Cool! I am glad that it is working for you.
Moving an actor around the scene is a different topic! But, I can say that you would plug in the coordinates for your actor's x and y position in the first numbers of each equation. (I think I called them game.SceneX, and game.SceneY in the original example.) Just replace those with the x and y coordinates of where you want to actor to be on the scene.
sebmacfly said: ... (the collide is not working between the ball and my flipper element)
Hi sebmacfly
Ummm.... collision problems isn't really the purpose of this thread. I will reply in your other thread that asks specifically about your flipper collisions.
I have made a little project which makes actors move in a circle, lemniscat and flowershape (with 4 or more leaves). It is a pretty raw project but I can clean it up and post it if people like the idea. I can post it as a ln example but can someone tell me where I can find the info on how to post an example. I lost it since arcade is online. The equations are pretty awesome.
I am going on a trip tonight but perhaps I can fin the time to do this today. Ales it will have to wait for a week.
the problem: if i have an actor that circles around a axis outside of himselfe and i use said formula, if the mouse is inside the circle of rotation the actor starts to jump around like crazy. how can i avoid that?
what i´m looking for: the rotation should be stable unti the center of the rotation axis and then flip to what ever side the axis is crossed to.
@Garanas -- The equations given in this thread do not exhibit the kind behavior your are describing. They work just fine no matter where the mouse is located. They are independent of mouse position.
This is confusing. You started another thread that has some formulas that are not working for you. Then you come on this thread and seem to be complaining that the equations given in this thread are not working. But I think you are referring to the formulas you created in your other thread. Which is it?
Do you want some help in your other thread? (The one that contains the equations that make the actor flip wildly?)
Garanas said: i tryed your formula and had the same problems as with mine. seems i did something wrong.
Ok -- thanks for letting me know that you actually are trying to use the off-center rotation equations. That helps clear up my confusion. I your other thread, your solution does not need off-center rotations. Instead it tries to orbit around a central point. (Which is a slightly different thing.)
Either way, the solution to to the flipping actor lies in the fact that you are using vectorToAngle with a moving target (the actor). Once you go to a fixed point, the flipping will go away.
I will post the solution to this in your other thread. (Whether you choose to make the actor rotate or to orbit, you will still need to fix this vectorToAngle 'challenge'.)
Rob2 said: @RT what do you mean by off-centered rotations exactly ?
I didn't mean to make it technical term. It certainly has gone by other names/terms -- like "axis of rotation," "pinned rotation point," "center of rotation," etc.
As you know, in GameSalad, all actors rotate at their center. The idea is to be able to spin (or rotate) the actor from any other spot besides it's exact center.
That's probably not the best explanation. Perhaps others could it define it more succinctly.
Rob2 said: So are you still having problems rotating about any point ?
LOL, me personally?!? No I've been able to rotate about any point for years. I was in a car crash once, and I discovered even more points to rotate about! But now that I'm getting older, I suppose I shouldn't try to rotate in such fashion.
As for GameSalad actors rotating (or spinning) about any point -- its not much of a problem there either. The first post of this thread shows one way to accomplish that.
But I'd be interested in any other approach that does not seem so intimidating to those who are math-adverse. Or that will improve speed. Or that furthers development in GameSalad.
I guess it was this bit "Unfortunately, I haven't been able to use them to rotate off-center" that you say at the top of this page that had me wondering
Rob2 said: I guess it was this bit "Unfortunately, I haven't been able to use them to rotate off-center" that you say at the top of this page that had me wondering
Oh... OK... I see what you mean now.
I really am interested in making it easier. The equations probably seem like magic incantations for many GS users. If there is something that is functionally the same, but can accomplish this without a lot of magic spells -- then I'm all for it. (I am hoping that it just eventually gets built into the rotation behavior's interface.)
So yes -- if you have a way to spin an actor 'off-center' I'd be interested to see it.
Also, as I tried to work out your original offerings. I might have misinterpreted what you were trying to convey. Perhaps I set up a straw man. But honestly, I couldn't get (what I thought) you were suggesting to work.
I really don't have all that much ego built up over this. (Well... OK... at first I was a little proud of the fact that I figured out a way to do this. I liked the fact that I actually figured something out and I probably bragged about it a little too much. But that's long past now.) I would be interested to know if there is a better, more intuitive (and less magic) set of equations. I'm all for shorter, more direct solutions.
It is based upon the actor. For example, if you wanted to spin your icon around the pink bunny nose, the x and y offset would probably be 100,-125 (just guessing).
You can also place the spinning actor anywhere on the scene.
OK -- and you have definitely given values to the four attributes (self.Position.X, self.Position.Y, self.offsetX, self.offsetY, and self.Rotation)?
How about plugging in in hard numbers into the equations -- just to see if that works.
Oh wait a minute. How about replacing self.Position.X and self.Position.Y with hard numbers for now. (I think that the actor might not want to reference itself like that.)
Comments
To translate Rob2's suggestion into GameSalad would be:
self.position.x = game.sceneX+magnitude(self.offsetX ,self.offsetY)*cos( self.Rotation )
self.position.y = game.sceneY+magnitude(self.offsetX ,self.offsetY)*sin( self.Rotation )
(If I have misunderstood what Rob2 was suggesting. Then I'd like see what was meant.)
Its basically the same approach. Except it swaps the cosine and sine functions and it lops off the arc-tangent subtractions.
Basically, these equations are for getting objects to orbit around a point -- and/or to describe a circle. Unfortunately, I haven't been able to use them to rotate off-center. The Y always evaluates to zero. I spent some time trying to get it to work. I tried all sorts of permutations of those equations -- but while they're great for getting things to orbit, I haven't been able to get them to work for off-centered rotations. Whenever I do come up with a winning solution, it just ends up being functionally equivalent to the original equations. (But I'd be happy to be proven wrong! I am all for shorter, more direct solutions.)
RThurman
to bad you can't rotate it from other than 0
Well done.
Asymptoteell
RThurman
Moving an actor around the scene is a different topic! But, I can say that you would plug in the coordinates for your actor's x and y position in the first numbers of each equation. (I think I called them game.SceneX, and game.SceneY in the original example.) Just replace those with the x and y coordinates of where you want to actor to be on the scene.
Can you help me?
Did you had this problem before? (the collide is not working between the ball and my flipper element)
See the post i made : http://gamesalad.com/forums/topic.php?id=31326&replies=5#post-231781
Thanks
Ummm.... collision problems isn't really the purpose of this thread. I will reply in your other thread that asks specifically about your flipper collisions.
I can post it as a ln example but can someone tell me where I can find the info on how to post an example. I lost it since arcade is online.
The equations are pretty awesome.
I am going on a trip tonight but perhaps I can fin the time to do this today. Ales it will have to wait for a week.
Cheers!
Ludwig
Lump Apps and My Assets
RThurman
not really.
the problem:
if i have an actor that circles around a axis outside of himselfe and i use said formula, if the mouse is inside the circle of rotation the actor starts to jump around like crazy. how can i avoid that?
what i´m looking for:
the rotation should be stable unti the center of the rotation axis and then flip to what ever side the axis is crossed to.
This is confusing. You started another thread that has some formulas that are not working for you. Then you come on this thread and seem to be complaining that the equations given in this thread are not working. But I think you are referring to the formulas you created in your other thread. Which is it?
Do you want some help in your other thread? (The one that contains the equations that make the actor flip wildly?)
RThurman
i will do some more testing. i tryed your formula and had the same problems as with mine. seems i did something wrong.
Either way, the solution to to the flipping actor lies in the fact that you are using vectorToAngle with a moving target (the actor). Once you go to a fixed point, the flipping will go away.
I will post the solution to this in your other thread. (Whether you choose to make the actor rotate or to orbit, you will still need to fix this vectorToAngle 'challenge'.)
RThurman
As you know, in GameSalad, all actors rotate at their center. The idea is to be able to spin (or rotate) the actor from any other spot besides it's exact center.
That's probably not the best explanation. Perhaps others could it define it more succinctly.
RThurman
As for GameSalad actors rotating (or spinning) about any point -- its not much of a problem there either. The first post of this thread shows one way to accomplish that.
But I'd be interested in any other approach that does not seem so intimidating to those who are math-adverse. Or that will improve speed. Or that furthers development in GameSalad.
RThurman
I really am interested in making it easier. The equations probably seem like magic incantations for many GS users. If there is something that is functionally the same, but can accomplish this without a lot of magic spells -- then I'm all for it. (I am hoping that it just eventually gets built into the rotation behavior's interface.)
So yes -- if you have a way to spin an actor 'off-center' I'd be interested to see it.
Also, as I tried to work out your original offerings. I might have misinterpreted what you were trying to convey. Perhaps I set up a straw man. But honestly, I couldn't get (what I thought) you were suggesting to work.
I really don't have all that much ego built up over this. (Well... OK... at first I was a little proud of the fact that I figured out a way to do this. I liked the fact that I actually figured something out and I probably bragged about it a little too much. But that's long past now.) I would be interested to know if there is a better, more intuitive (and less magic) set of equations. I'm all for shorter, more direct solutions.
RThurman
You can also place the spinning actor anywhere on the scene.
Perhaps its explained better in the cookbook: http://cookbook.gamesalad.com/#question=4e27096fdb04ec16100000d5
RThurman
This is what i have with an x offset of -32 and a y offset of 0. I'm trying to just rotate a rectangle from one end.
What is it doing? Is it disappearing from the screen? Just sitting there? Is it spinning the wrong direction or from the wrong xy point?
Edit: does it have to use rotate or rotate to? I wonder if it's because I'm using Interpolate?
How about plugging in in hard numbers into the equations -- just to see if that works.
Oh wait a minute. How about replacing self.Position.X and self.Position.Y with hard numbers for now. (I think that the actor might not want to reference itself like that.)