Gravity?

sonicm3sonicm3 Member Posts: 141

Hi, I have Gravity on my scene and all works well, but... I need to make an actor rotate based on touch however when I click movable, he falls down the page and rotates, I need to keep this actor mid air in position but can rotate based on mouse press..
Any idea?

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    Switch the scene gravity off, and then apply a downward acceleration (using the Accelerate behaviour) to the actors you want to be effected by gravity.

  • GnarlyGnarly canadaMember Posts: 840

    Accelerate behaviour works best for scenes where you want gravity effect on some actors and not others.......

    I assume the actor falling you don't want it to be effected by gravity????

  • sonicm3sonicm3 Member Posts: 141

    Hi yes the only actor I really need effected by gravity is actor 1,

  • sonicm3sonicm3 Member Posts: 141

    hmm quick question guys, if I make actor1 effected by accelerate how would I still make it actor1 on touch to move right to launch of the platform? would I need a whole new rule, and what angle would be best to get the best result straight down or slightly angled?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    If you are comfortable with using gravity just constrain the position of the actor you want to rotate.

    If you do it this way you can just drag it where you want.

    Make two real self attributes lock-X and lock -y

    In your actor

    Change attribute self.lock-X to self.positionX
    Change attribute self.lock-Y to self.positionY

    Constrain attribute self.positionX to self.lock-X
    Constrain attribute self.positionY to self.lock-Y

    Now you can check both moveable and fixed rotation and the actor will stay in place and be rotatable.

  • SocksSocks London, UK.Member Posts: 12,822

    @sonicm3 said:
    how would I still make it actor1 on touch to move right

    When touch is pressed move right (use whatever move behaviour you prefer).

  • sonicm3sonicm3 Member Posts: 141

    I see, thanks so much for the help, btw one last question (promise) :)
    I can touch to rotate a platform, how do I have it so the end user can drag an actor to any position they want?

  • sonicm3sonicm3 Member Posts: 141

    Hi I just dont seem to be that happy with this down acceleration it just does not seem to capture the way gravity seems to work, either that or I am not doing this correctly.
    what would you recommend to be placed as a substitute for gravity as acceleration?

  • sonicm3sonicm3 Member Posts: 141

    "If you are comfortable with using gravity just constrain the position of the actor you want to rotate."

    Hi the actor I am not actually rotating, basically if you imagine a block that when pressed moves right from a fixed platform, the actor then falls down a 45 deg slope and you can rotate that slope to any angle you like and there are also a few more slopes to do the same, I want the actor to have real gravity effects during the scene as he accelerates down the slope and lands on the other slopes ect.. each slope I have made can be rotated by the end user, I just need the actor to 1. keep real gravity 2. accelerate down the slope and decelerate when the slope is to great ect... its a learning game for kids.

  • SocksSocks London, UK.Member Posts: 12,822

    @sonicm3 said:
    I can touch to rotate a platform, how do I have it so the end user can drag an actor to any position they want?

    When touch is pressed
    --constrain position x to mouse x
    --constrain position y to mouse y

  • SocksSocks London, UK.Member Posts: 12,822

    @sonicm3 said:
    Hi I just dont seem to be that happy with this down acceleration it just does not seem to capture the way gravity seems to work, either that or I am not doing this correctly.
    what would you recommend to be placed as a substitute for gravity as acceleration?

    Acceleration works identically to gravity, you have probably not set it up correctly.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Has anyone made a feature request for a "disable gravity" actor attribute?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2016

    @tatiang said:
    Has anyone made a feature request for a "disable gravity" actor attribute?

    You can switch scene gravity off (and stop any movement) with:

    Change Gravity Y to 0
    Change Linear Velocity Y to 0

    . . . is that what you mean ?

  • GnarlyGnarly canadaMember Posts: 840

    @tatiang said:
    Has anyone made a feature request for a "disable gravity" actor attribute?

    That would be handy!

  • SocksSocks London, UK.Member Posts: 12,822

    @tatiang said:
    Has anyone made a feature request for a "disable gravity" actor attribute?

    Ah ! Just got it, you mean per actor ?

  • SocksSocks London, UK.Member Posts: 12,822

    This should work:

    Change Lock to self Y
    Constrain self Y to Lock

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2016

    If you just want a single actor to remain unaffected by scene gravity you can use this:

    Accelerate / 90° / Speed: gravity Y

    . . . . mind you, you can achieve the same thing by switching 'moveable' off on the actor you want to exclude from scene gravity.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    You can uncheck moveable on any actor and use the interpolate behavior to rotate or move as it works outside the physics engine.

  • SocksSocks London, UK.Member Posts: 12,822

    @Lost_Oasis_Games said:
    You can uncheck moveable on any actor and use the interpolate behavior to rotate or move as it works outside the physics engine.

    Yeah, you could also use Constrain (e.g. Constrain Rotation to Game.time*10).

  • sonicm3sonicm3 Member Posts: 141
    edited April 2016

    so guys, if this is my current scene resulting it just falling off the screen what should the code read to keep this in position and touch to rotate.
    thanks, my code reads...

    http://s24.postimg.org/tf88dgpg5/rotate.jpg

  • sonicm3sonicm3 Member Posts: 141

    @Socks said:
    If you just want a single actor to remain unaffected by scene gravity you can use this:

    Accelerate / 90° / Speed: gravity Y

    . . . . mind you, you can achieve the same thing by switching 'moveable' off on the actor you want to exclude from scene gravity.

    Hi yes, that would be fine the only thing is I need the actors to be touched to rotate so the moment I click moveable off the actors do not rotate on touch, I need to have it on to move them, wish there was a feature you can untick on an actor called disable actor from all gravity. :)

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Maybe this demo will help.

  • sonicm3sonicm3 Member Posts: 141

    Hi there I cant seem to load that up.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Its a compressed file. You might need to unzip it.

  • sonicm3sonicm3 Member Posts: 141

    hmm yer did that but it loads 0 bytes into gamesalad,

  • sonicm3sonicm3 Member Posts: 141

    Hi I managed to solve the issue with gravity, ok thanks for the help much appreciated, I did it a bit of a crazy way but got the result I needed.

Sign In or Register to comment.