Gravity?
sonicm3
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
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.
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????
Hi yes the only actor I really need effected by gravity is actor 1,
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?
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
When touch is pressed move right (use whatever move behaviour you prefer).
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?
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?
"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.
When touch is pressed
--constrain position x to mouse x
--constrain position y to mouse y
Acceleration works identically to gravity, you have probably not set it up correctly.
Has anyone made a feature request for a "disable gravity" actor attribute?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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 ?
That would be handy!
Ah ! Just got it, you mean per actor ?
This should work:
Change Lock to self Y
Constrain self Y to Lock
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.
You can uncheck moveable on any actor and use the interpolate behavior to rotate or move as it works outside the physics engine.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Yeah, you could also use Constrain (e.g. Constrain Rotation to Game.time*10).
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
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.
Maybe this demo will help.
Hi there I cant seem to load that up.
Its a compressed file. You might need to unzip it.
hmm yer did that but it loads 0 bytes into gamesalad,
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.