playMaker

Author Topic: Create an object when you click  (Read 2835 times)

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Create an object when you click
« on: February 24, 2018, 09:01:01 AM »
Hi, I tried to search and did not find.
Is it possible to use the Playmaker to make the player place an object (for example a circle or a square, not important) after clicking at any chosen place on the whole screen or in a certain area?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Create an object when you click
« Reply #1 on: February 24, 2018, 11:22:08 AM »
Yes, try these actions.

Mouse button down. Then go to next state. Then mouse pick. Save the 'store normal' to a vector3. Then use create object. Set the position to the stored normal variable.

Lastly, make an event for Mouse button down again, to see if it has come up. Once up, go back to the start.

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Create an object when you click
« Reply #2 on: February 26, 2018, 07:59:11 AM »
Yes, try these actions.

Mouse button down. Then go to next state. Then mouse pick. Save the 'store normal' to a vector3. Then use create object. Set the position to the stored normal variable.

Lastly, make an event for Mouse button down again, to see if it has come up. Once up, go back to the start.

Hi,
Thanks but I had such problems as:
The object was created after a mouse click, but it always appeared in the center of the main camera of my 2d project in the game scene, but it was not displayed in the running game.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Create an object when you click
« Reply #3 on: February 26, 2018, 09:14:21 PM »
Make sure are using the mouse 2d events. Double check debug in on, and create a break point when the object is placed. Check the create action is set the right place.

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Create an object when you click
« Reply #4 on: February 27, 2018, 03:40:42 AM »
Make sure are using the mouse 2d events. Double check debug in on, and create a break point when the object is placed. Check the create action is set the right place.

I'm a little confused, I attach a screenshot on which I created the state as you described. In which step do I need to use the Mouse pick 2d events?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Create an object when you click
« Reply #5 on: February 27, 2018, 07:29:15 AM »
Hi, try the action "mouse pick 2d"

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Create an object when you click
« Reply #6 on: March 01, 2018, 02:42:38 AM »
Hi, try the action "mouse pick 2d"
Hi,
as far as I understand, Mouse Pick 2d transmits the position value to vector2, but Create object can only use vector3.
There was another oddity, the value of Store Point in Mouse Pick 2d covered a very limited area during the game launch, about 1/8 of the area where you could control the mouse.