Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Poltor on February 24, 2018, 09:01:01 AM

Title: Create an object when you click
Post by: Poltor 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?
Title: Re: Create an object when you click
Post by: tcmeric 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.
Title: Re: Create an object when you click
Post by: Poltor 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.
Title: Re: Create an object when you click
Post by: tcmeric 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.
Title: Re: Create an object when you click
Post by: Poltor 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?
(https://i.imgur.com/FX2ASg7.png)
Title: Re: Create an object when you click
Post by: tcmeric on February 27, 2018, 07:29:15 AM
Hi, try the action "mouse pick 2d"
Title: Re: Create an object when you click
Post by: Poltor 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.