playMaker

Author Topic: How do you attach a trigger to a moving object?  (Read 4001 times)

ashwhite

  • Playmaker Newbie
  • *
  • Posts: 4
How do you attach a trigger to a moving object?
« on: April 13, 2016, 04:13:15 PM »
Hi guys,

I'm a newb and currently trying to make a stacking game. The premise is that the user has to stack multiple layers of a low-poly object in order to complete the level. Please see the attachment for reference of the gameplay.

I'm stuck on the best approach for getting the static object to lock with the falling and rotating object. My guess is to use triggers instead of a standard collider as I couldn't work out how to initiate a locked state with the faces lined up exactly.

If triggers are the best route to take here I presume I need to apply a trigger to the face of a static object and also attach one to the face of a falling object somehow but I don't know how to execute that.

I'd really appreciate any help given.

Apologies if my terminology is wrong or unclear. I'm just picking up Unity and Playmaker.

Looking forward to responses :)

Ash

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How do you attach a trigger to a moving object?
« Reply #1 on: April 14, 2016, 07:08:36 AM »
Hi,
when you look to your game object in the inspector try to find if there is a collider,
if there is none you can click on "Add component" and look for "collider"

If you have a mesh collider i think it is better to change it to a box collider for your project.

Select the collider.

In the collider component you have check box called "Is Trigger"

Select that one and now your collider is a trigger and not colliding.

You can also make the size a bit bigger or set the position higher from the trigger/collider

you can also use 2 colliders and set one to trigger and set the other as collider.


For your project i think it is best to use triggers

ashwhite

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How do you attach a trigger to a moving object?
« Reply #2 on: April 14, 2016, 10:53:50 AM »
Hi Dino,

Thanks for your response. I've attached my current setup for both the falling and static objects. I unselected 'Is Trigger' as it kept passing through the static object. From what you are saying I guess I need to add triggers to both objects to cause a collision and avoid the falling object passing through the static one. Is that correct?

I also need to define the alignment for when both objects collide? Because the falling object is rotating as it drops it needs to be correctly aligned when they collide to progress. Currently it continues to spin when both objects collide as I'm not sure how to setup the triggers in a way that it registers the shape of both objects.

I already tried adding a trigger to the top surface of the static object so that when the falling object collided it would initiate a state. The trouble was that it didn't take account for the alignment (matching shapes), just the contact which is not what I'm looking for. Is there a setting in playmaker that can achieve something like "if the object fills 100% of the trigger volume on collision, execute something..".

Apologies for my lack of understanding on this. I'm reading up on lots of unity material but not finding anything that is working and not entirely sure I'm asking the right questions with the right terminology so opted for the forums for a more human touch.

Thanks! 


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How do you attach a trigger to a moving object?
« Reply #3 on: April 14, 2016, 11:07:17 AM »
Hi,
i will try to make a sample for you this weekend and make video of it.

meanwhile you can look for "unity playmaker tutorials" on youtube to understand more about playmaker :)

ashwhite

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How do you attach a trigger to a moving object?
« Reply #4 on: April 16, 2016, 06:01:18 AM »
Thank you djaydino. Huge appreciation :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How do you attach a trigger to a moving object?
« Reply #5 on: April 16, 2016, 02:53:54 PM »
Hi,
Here is the video and below you can find the sample scene :



Quote
Sample temporary removed
« Last Edit: April 18, 2016, 07:31:55 PM by djaydino »

ashwhite

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How do you attach a trigger to a moving object?
« Reply #6 on: April 17, 2016, 11:05:51 AM »
Wow @djaydino! That's exactly what I needed. Thank you so much!

I can't believe the amount of trouble you went to and I'm so very grateful.

I can't wait to finish my game and I'll be sure to share my progress with you.

Thank you again for your help and guidance :)

Ash

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How do you attach a trigger to a moving object?
« Reply #7 on: April 17, 2016, 05:47:56 PM »
Hi,
with pleasure :D

If you ever get rich from the game... don't forget me :P:P:P