Playmaker Forum

Playmaker Help & Tips => Playmaker Help => Topic started by: Dev_Sebas on January 28, 2012, 03:26:43 PM

Title: Get/Set Position
Post by: Dev_Sebas on January 28, 2012, 03:26:43 PM
Hi
In my game I shot with left mouse and it creates and add force to an bullet prefab.
That prefab have one FSM with 4 states.One for add force and an transition "Collision Enter".
Anther state to get position of bullet(maybe it is the problem).
Another for create an hole (My glass prefab)
And another for set position of glass prefab.
All good but my glass hole is created on 0.0.0 and don´t go to the right position.
Please help me
Bye
Title: Re: Get/Set Position
Post by: Dev_Sebas on January 30, 2012, 01:15:40 PM
Please help me
Bye
Title: Re: Get/Set Position
Post by: Alex Chouls on January 30, 2012, 05:13:05 PM
You need to store the created object in a GameObject variable, then use that variable in SetPosition. Or set the position in the CreateObject action.

Right now you're just setting the position of the prefab, which isn't in the scene.
Title: Re: Get/Set Position
Post by: Dev_Sebas on January 31, 2012, 02:16:16 PM
Thanks for reply but my hole stays on the same place.
Any help is much appreciated
Bye
Title: Re: Get/Set Position
Post by: Dev_Sebas on January 31, 2012, 03:03:52 PM
Mouse Pick only functions in Camera? No?
Bye
Title: Re: Get/Set Position
Post by: jeanfabre on January 31, 2012, 10:26:21 PM
Hi,

 I think the problem could be that within your prefab fsm, you have referenced the hole or something NOT in the prefab, and that reference is lost when you instanciate a prefab in the scene.

else it might simply a silly miss in one of the actions.

Could you share the scene? if not, I can fo a working scene over the week end that fire a prefab bullet and where it falls creates a hole. but that will not be until monday.

Bye,

 Jean
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 01, 2012, 03:17:19 PM
Hi Jean thanks for reply
I have send it for your mail because this forum does n´t accept too much scape.
Bye thanks
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 07, 2012, 12:51:46 PM
Please give me any help
Bye
Title: Re: Get/Set Position
Post by: speedything on February 07, 2012, 04:25:09 PM
I assume you've checked your variable "Colission" and made certain it's not vector(0, 0, 0)?

If you have and it's ok then the problem is definitely when you set the position of the glass. Are you not able to set it directly in the Create Object action?
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 08, 2012, 07:02:58 AM
I put the vector3 in create object position too but it doesn´t work.
Bye
Title: Re: Get/Set Position
Post by: speedything on February 08, 2012, 07:18:12 AM
Ok, try placing the glass object in the scene and out of view (e.g. Vector(0, 1000, 0)).

Then, when the bullet hits, create a new version of that object (as you are doing) instead of using the prefab.

Title: Re: Get/Set Position
Post by: Dev_Sebas on February 08, 2012, 01:16:54 PM
I have put the prefab in my scene as game object and I change the thinks as prefab to that game object, but it´s the same.
The problem I think is in the get position
Bye
Thanks for any help
Title: Re: Get/Set Position
Post by: speedything on February 08, 2012, 02:43:35 PM
I've attached a picture of an FSM similar to yours that works as you intend. Its a simple scene with just a wall, a bullet, and a hole (and camera and light). All of the script is shown in the picture.

Hopefully this will solve your problem. Just to clarify, the two pics at the bottom are before I fire missile (red bullet) and after (black hole).

If you're still stuck after this I can maybe try to send the scene, but you'll need to provide a way for me to send the 35MB project to you.

Best of luck
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 09, 2012, 03:56:38 PM
Thanks speedything.I will try it thanks a lot for reply
Cheers Seb
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 09, 2012, 05:01:31 PM
Your FSM is in the bullet object no?
I have an camera, some walls and the bullet object with your actions on that and the hole object. But if your bullet have add force action it needs an rigidbody. I have add it but when I play the game the bullet falls.Yes?Have I forget anything?
Bye thanks for anyhelp
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 17, 2012, 12:30:26 PM
Please help me guys
Bye
Title: Re: Get/Set Position
Post by: Alex Chouls on February 17, 2012, 01:19:31 PM
There's a Use Gravity checkbox in Rigid Body. Have you played with that?
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 18, 2012, 05:25:51 AM
I´m gonna see it Alex
Thanks for reply
Bye
Title: Re: Get/Set Position
Post by: Dev_Sebas on February 19, 2012, 02:28:27 PM
I put use gravity off and when the bullet is trowed I add action use gravity but it´s continues not working
Any help will be aprociated
Bye