Math question
I'm using this equation to make an actor function like a windshield wiper (20*sin((self.time*200)%360)) it works awesome but I would like to define the starting rotation angle, in other words facing left, right up or down flipping at 20 degrees. I've tried predefining the rotation but it always defaults to the same direction. Okay Mr Wizard help me.
Comments
In that demo to define the windshield rotation you need to add or subtract a value from the long actor instance constrain rotation rule.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
However if you want to use your formula try to add or subtract a value from it and see if it changes anything.
A*sin(game.Time*B)+C
A range of sweep
B=speed
C=offset in degrees.
self.startAngle+(self.wiperTravel*sin(( self.Time*self.wiperSpeed )%180))
Edit:
I think @Socks wins this one! It would look something like this in GS speak:
(90+self.startAngle)+((self.wiperSweep/2)*sin(self.Time*self.wiperSpeed))
Edit: damn guys I need a math tutor! I was never very good at trig or calculus. I gave you all an awesome.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Two constrains X & Y with the offsets.
Constrain: Self.position X (TO) tableCellValue( game.Bumper_Picked.TBL ,2, self.Spawn Location # )-magnitude( self.Offset X , self.Offset Y )*sin(( self.Rotation )-atan( self.Offset X / self.Offset Y ))
Constrain: Self.position Y (TO) tableCellValue( game.Bumper_Picked.TBL ,3, self.Spawn Location # )+magnitude( self.Offset X , self.Offset Y )*cos(( self.Rotation )-atan( self.Offset X / self.Offset Y ))
One Change attribute if pulling starting rotation from another attribute or table. If preset angle then just change the value of the self attribute, Self.start_angle, in the actor. If not do below.
Change attribute: Self.start_angle (TO) Value of start angle.
Next we need to constrain the actors Self.Rotation to the equation.
Constrain: Self.Rotation (TO) Self.start_angle+(20*Sin((Self.Time*200)%360))
(20 is wipe angle) (200 is speed)
Works fantastic thanks guys.
@markontheiorn Why I didn't use yours is because it relies on another actor with a host of rules. Using this method I could abandon the other actor and its code.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
It should work fine, but to be honest you don't state what you are using in your original post (I assumed it was constrain rotation . . . ?)
If it is constrain attribute / self.rotation . . this will give you an undulating rotation:
Constrain attribute: self.Rotation To: 45*sin( game.Time *100)
And this will give you an offset of 20 degrees.
Constrain attribute: self.Rotation To: 45*sin( game.Time *100)+20
>"Constrain: Self.Rotation (TO) Self.start_angle+(20*Sin((Self.Time*200)%360))"
Also here you don't need the '%360' from what I can see as the values are constantly moving between -20 and +20 (via 0) - unless I am misunderstanding why you are using the %360 ???
It could simply be Self.start_angle+20*Sin(Self.Time*200) . . . . or put another way . . . . 20*Sin(Self.Time*200)+Self.start_angle . . . . or put another way . . . A*sin(game.Time*B)+C
; )
http://forums.gamesalad.com/discussion/38641/pinball-flippers-is-this-possible-and-how
@capitalcarnage -- I hated those math problems in school. (I still do.) I bet if i could have used GameSalad I would have figured them out!
http://www.mediafire.com/?fdmqkst2s28oez4
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
"I'm lost on the offset you set up."
There is no offset, I'm just shaking the actor up and down and a little left and right - at the same time as rotating it.