playMaker

Author Topic: Get/Set Position  (Read 11843 times)

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Get/Set Position
« on: January 28, 2012, 05: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

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #1 on: January 30, 2012, 03:15:40 PM »
Please help me
Bye

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Get/Set Position
« Reply #2 on: January 30, 2012, 07: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.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #3 on: January 31, 2012, 04:16:16 PM »
Thanks for reply but my hole stays on the same place.
Any help is much appreciated
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #4 on: January 31, 2012, 05:03:52 PM »
Mouse Pick only functions in Camera? No?
Bye

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get/Set Position
« Reply #5 on: February 01, 2012, 12:26:21 AM »
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

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #6 on: February 01, 2012, 05: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

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #7 on: February 07, 2012, 02:51:46 PM »
Please give me any help
Bye

speedything

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Get/Set Position
« Reply #8 on: February 07, 2012, 06: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?

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #9 on: February 08, 2012, 09:02:58 AM »
I put the vector3 in create object position too but it doesn´t work.
Bye

speedything

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Get/Set Position
« Reply #10 on: February 08, 2012, 09: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.


Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #11 on: February 08, 2012, 03: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

speedything

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Get/Set Position
« Reply #12 on: February 08, 2012, 04: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

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #13 on: February 09, 2012, 05:56:38 PM »
Thanks speedything.I will try it thanks a lot for reply
Cheers Seb

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Get/Set Position
« Reply #14 on: February 09, 2012, 07: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