playMaker

Author Topic: Rotating an object then finishing state?  (Read 1516 times)

thebrobotic

  • Playmaker Newbie
  • *
  • Posts: 5
Rotating an object then finishing state?
« on: August 04, 2014, 11:13:33 PM »
I'm having a ton of fun with PlayMaker tonight, and I feel that I need to finish one final thing before I sleep..

I have a Flappy Bird-like game. You click to move, and the scene is parallax scrolling etc.. Anyways, it's a 2d view and the main player is cube shaped. However, I want each click to set the object to rotate(to give a spinning motion, looks cool with an orthographic view). But every time I get the object rotating - the state doesn't detect that it's finished and never moves on. Thus I can only click once and the object rotates, but I fall to the ground and die.

Could anyone give me some advice on this, please?

EDIT; played around some more .. just realized that when I rotate the object, it also affects the direction my 'add force' state is doing and pretty much breaks the game. I suppose it's not possible to rotate an object that has a rigidbody and not have it affect its movement? I just really love the way a rotating 2d cube looks.
« Last Edit: August 04, 2014, 11:22:29 PM by thebrobotic »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotating an object then finishing state?
« Reply #1 on: August 06, 2014, 06:07:58 AM »
Hi,

 what you need is to express your force in world coordinates as opposed to relative.

 IF your object is rotating, then you need to use the velocity vector of your object, normalize it and then you have your current forward direction to apply a force to it.

Also, if you just want the current world up direction in relative coordinates, use "Inverse Transform direction" to get the desired up vector in relative coordinates.
 
Bye,

 Jean