playMaker

Author Topic: How to make object trigger SetPosition to specific coördinates?  (Read 4631 times)

ginoadriano

  • Playmaker Newbie
  • *
  • Posts: 5
Hello, i'm fairly new to using playmaker and got around some of the basic functions by following tutorials. However, i'm not sure how to achieve what i'm trying to do here and which steps to take.

I'm building a sort of puzzle-game where the user needs to find a certain object in a room. (player needs to do this from a fixed position and can only look around, so no walking involved)
Once the player has found the object, i want the Firstperson-controller to send a raycast to the object.
The raycast needs to trigger a teleportation to the next room. (ideally specific coördinates which i can input manually).

The goal is to visit multible rooms in a single level through different objects, each triggering their own set of coördinates onto which the player is being teleported.

Also i want the teleport to have a 2 second delay so the player has time to look away, to not have the object found being too obvious and giving the user a chance at second guessing.


At the moment i have one object in my level, one FPS controller sending a raycast(state 1, event:hit), and the "Setposition" action is set to State 2, player teleports to value X = 20. (by looking at a sphere)

ginoadriano

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #1 on: July 16, 2015, 02:38:43 PM »
Anyone?

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #2 on: July 16, 2015, 08:42:01 PM »
what part are you having trouble with?

ginoadriano

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #3 on: July 18, 2015, 02:41:10 PM »
Well i'm not sure if i'm approaching this the right way.
All of my states are now coupled to my FPS controller.

My goal is to have a game with like 12 rooms,
each room has one object which ,on discovery, should trigger a
2 sec delay/countdown and then teleport player to coordinates.
For object 1 it could be something like : x=20 z = 10 (room 2)

Then in room 2 i need an object to do the same thing but with different coördinates....and so on.

I couldn't find any tutorial about this specific use since most games use teleportation by stepping onto an item or trigger but in my concept the entire game is played in a sphere where the player is static and can only rotate/look around.

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #4 on: July 18, 2015, 02:49:45 PM »
But what are you having trouble with?
Is it triggering the event when you look at the object? Setting a new position for the player?

ginoadriano

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #5 on: July 20, 2015, 08:20:07 AM »
I'm having trouble with how to do this.

Room 1 needs to have a quad. The quad needs to trigger a teleport to x20, z10.
And it needs a 2 second delay.

I don't know how to do either. Do i attach states or actions to the quad? Can i then set different position values for each quad?

As i mentioned...i have everything on the FPS controller right now and it basicly does one teleport, without the delay. It doesn't do more then 1 teleport. After i teleported it doesn't do anything anymore.

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #6 on: July 20, 2015, 08:46:59 AM »
There would be many ways to do it. Here's an example:

- Have a trigger object with a collider. Give this object a tag like "interact".
- On the camera, have a mousepick action. Store the gameobject in a variable.
- Run a compare tag action every frame on the gameobject variable, send an event if it matches your tag.
- In the next event, have a wait action with a 2 second delay.
- In the next one, set the FPS controller's position to your new coordinates with Set Position.

ginoadriano

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #7 on: July 20, 2015, 10:20:13 AM »
Thanks Terri, i'll try that. Any idea if i could use a simple raycast to trigger the event in stead of mouseclick, will that work in a similar manner?

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: How to make object trigger SetPosition to specific coördinates?
« Reply #8 on: July 20, 2015, 11:37:11 AM »
In my suggestion I used mousepick, not mouseclick, but yeah, you can use a raycast cast from the camera with the direction 0,0,1 (self) and check the tag of the stored hit object.