Physic (gravity) issue

rebzonerebzone Member Posts: 25
edited March 2012 in Working with GS (Mac)
Hi everyone,
I'm trying to make an actor simply fall in a rotating environment, but I can't handle it...
Here some details: I have an empty box rotating 90 degrees every, let's say, 3 seconds. In this box I added an actor which rotates with the box while it rotates (I added a lockdown attributes that "release" the actor when the rotation ends), and when it stops, the actor should simply fall.
I've seen TSB's tutorial where he says to use accelerate behaviour instead of gravity, and that's what I did.
So, when the rotation ends, the actor has an accelerate behaviour with 270 as direction (relative to scene) and a speed of 400.
The problem is that, even if I've tried "playing" with physic attributes, the actor doesn't move just on the Y axis...it slightly tends to move left or right too (just 1 or 2 pixels, but I need to keep the X position fixed)...
Do you have any ideas on how to resolve this issue?
Thanks a lot

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    What X do you want the actor to be at?
    tell the computer with a changeAttribute or constrainAttribute to make it so.

    if you do not know the exact X when rotation stops:
    create an actorAttribute on the prototype … real type … name it … myX
    and when rotation stops … change that to self.Position.X
    and do your change or constrain to self.Position.X To: myX

    also check that your actor is an even number of pixels in width and in height

    @rebine … your project sounds exciting!

    @};- MH
  • rebzonerebzone Member Posts: 25
    Thanks MotherHoose... I still have to get confident with some behaviours (like constrain attribute), and your hint sounds like it could be the answer I needed :)
    I'll try it out this evening and then I'll let you know ;)
    Thanks
  • rebzonerebzone Member Posts: 25
    Hey MH,
    I've just tried what you suggested, and it works great! :)
    Thanks a lot!!!
Sign In or Register to comment.