playMaker

Author Topic: How to rotate object around axis using the mouse(X&Y)  (Read 11414 times)

ghost010

  • Junior Playmaker
  • **
  • Posts: 51
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #15 on: March 12, 2014, 11:18:35 AM »
Let's make sure I understand what you are trying to achieve in the 3rd one.

You don't want the rocket to follow the mouse cursor.
Instead just check once where the mouse is compared to the spawn point of the rocket, get the direction and let the rocket fly straight ahead in that direction.

Much Easier! No?

Br,
Peter

Do you know the game astroids?

In most cases you rotate with the axis (up down left right).
The ship will go to the direction its  pointing at.
Thats what i want,but with mouse input(doing it with up down left right is easy)


Look at script uses a target position.=> Going to the target.
All i need is the direction it will face at.=>Point towards direction.

purbanics

  • Junior Playmaker
  • **
  • Posts: 55
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #16 on: March 13, 2014, 02:54:48 AM »
I think my solution does exactly that, just get the world position of the mouse cursor and use that as the "node" position.

Then as you move the mouse cursor (the "node") around your spaceship, your ship will always look at the mouse cursor.

Br,
Peter

ghost010

  • Junior Playmaker
  • **
  • Posts: 51
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #17 on: March 13, 2014, 03:49:51 AM »
already tryd your solution,but it didnt work for me,the mesh wouldnt even rotate. it just flips the Y position from up to upside down and that in a loop.

purbanics

  • Junior Playmaker
  • **
  • Posts: 55
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #18 on: March 13, 2014, 04:14:06 AM »
For me it works exactly as the ship should rotate in Asteroids.

You could try putting together a screenshot of your solution (like I did to show mine) so somebody can point out the error? in your implementation.

Br,
Peter

ghost010

  • Junior Playmaker
  • **
  • Posts: 51
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #19 on: March 13, 2014, 04:41:02 PM »
here yha goo.

Also,all of the sudden i encounter a loop error after trying to get my mouse position with mouse pic storing it to gameobject.
removed mouse pic,but when i change the gameobject position it starts to flipout or give loop error.



This was how i stored the mouse position(didnt work)




In the screen shot it says greater than,but i changed that to less thaN,BUT IT STIL HAPPENS. oops caps
« Last Edit: March 13, 2014, 04:45:10 PM by ghost010 »

purbanics

  • Junior Playmaker
  • **
  • Posts: 55
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #20 on: March 14, 2014, 04:43:02 AM »
Oh my..... !!!
You need to learn to use Paint and put the important parts of your shots together into one image.

It's good that you found the "Less than" error.

I guess what you are missing is that you want to move the "node" around, so the ship can turn toward it. For this you need to save the position of the mouse pick and move the node to that in every frame.

Br,
Peter

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #21 on: March 14, 2014, 07:12:23 AM »
Hi,

 no, it's not going to be added I think. But I am working on a online browser that will ease the process of accessing these custom actions, coming soon :)

bye,

 Jean

ghost010

  • Junior Playmaker
  • **
  • Posts: 51
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #22 on: March 14, 2014, 03:14:32 PM »
Oh my..... !!!
You need to learn to use Paint and put the important parts of your shots together into one image.

It's good that you found the "Less than" error.

I guess what you are missing is that you want to move the "node" around, so the ship can turn toward it. For this you need to save the position of the mouse pick and move the node to that in every frame.

Br,
Peter

I did that,but that did not work as the setup you have searches for a game object.
Als,manually moving the game object passes the character out.

ghost010

  • Junior Playmaker
  • **
  • Posts: 51
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #23 on: March 14, 2014, 03:16:44 PM »
Hi,

 no, it's not going to be added I think. But I am working on a online browser that will ease the process of accessing these custom actions, coming soon :)

bye,

 Jean
Good to hear.
I'm working on a custom action my self,its almost done.
But can you answer on when something is a "custom action" and under what circumstances you can sell a custom action(s)?

A link with that info would be fine too.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to rotate object around axis using the mouse(X&Y)
« Reply #24 on: March 18, 2014, 09:16:54 AM »
Hi,

 a "custom" action is simply a playmaker action that is not official part of the playmaker package you download form the asset store, that's all!

so you can sell your custom actions if you want too, nothing wrong with that.

bye,

 Jean