Randomly rotate a non-moving actor

FangFang Member Posts: 33
edited November -1 in Working with GS (Mac)
Hey all

I'm having a bit of trouble again (and I bet the solution is really simple again, but I can't seem to figure anything out).
I have an actor that I want to rotate counterclockwise at a speed that changes to a random(200,400) every second. I also want other actors to be able to collide with it.
For the rotation, it needs to be movable. But if it's movable, and another actor collides with it, it slides away.
How do I make it so that it can rotate, but doesn't move on collide?

Thanks,
~ Fang

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi, I had trouble with this in one of my projects: still the rotating actor moved with collision, no matter how high its Density/Friction/Drag was, zero restitution as well.

    A workaround is the following (which I haven't tested yet though, but can't see why it shouldn't work): two integer attributes, one has the x value of the actor, the other the y value, called Actor1 x and Actor 1 y. A third and fourth real attributes, lets call them A1 ConX and A1 ConY; in Rules, Two constrain behaviours to the rotating actor. and Rules: when A1 ConX does not equal Actor1 x, change attribute Actor1.position.X to Actor1 X. Same for Y.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • YarikYarik Member Posts: 15
    even if the difference in densiti 1000000, actor still slightly shifted

    create an additional actor ...actorX (invisible or behind the scenes)
    actorX rotates as you want
    constrail actorX.Rotation to game.actorXRotation
    and constrail game.actorXRotation to self.Rotation fixed actor
  • FangFang Member Posts: 33
    @Yarik
    Your method seems easiest, thanks a bunch.

    But is there really no simpler solution? Find it kind of odd that disabling actor movement also disables rotation, seeing as how rotating doesn't change its location...
  • YarikYarik Member Posts: 15
    really strange, because there are 2 separate attribute (Fihed Rotation And Movable)

    always happy to help =)
  • FangFang Member Posts: 33
    @Yarik: but that's the whole point: it won't rotate unless movable is checked, and thus it moves when it collides with another actor.
Sign In or Register to comment.