playMaker

Author Topic: (Solved) Moving object on a platform?  (Read 4543 times)

Aaddiction

  • Full Member
  • ***
  • Posts: 166
(Solved) Moving object on a platform?
« on: June 07, 2014, 05:01:58 PM »
I have a moving platform. When an object gets on the platform (character, vehicle, etc) and the platform starts moving, the object on it falls, it does not move with the platform.

So I made a trigger which detects if there is an object on the platform and if yes, it should make it a child object to the moving platform. However, it's not working properly. The child object becomes weirdly squashy and fps drops.

Is there a solution about that? I realize that the question problem is not Playmaker, but if anyone can help how to make it work with it, please do.

Found someone with the same issue:
« Last Edit: June 08, 2014, 06:21:21 AM by Lockon302 »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Moving object on a platform?
« Reply #1 on: June 07, 2014, 05:23:40 PM »
Does the object have a RigidBody? Maybe it's fighting with physics? Try setting the isKinematic property to true...

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: Moving object on a platform?
« Reply #2 on: June 07, 2014, 05:32:45 PM »
Does the object have a RigidBody? Maybe it's fighting with physics? Try setting the isKinematic property to true...

Yes, it has. When I add isKinematic I can't move any more. I'd like to be able to move, jump and etc on it. I'll see that the 2D Platformer example, they say there's something similar there.

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: Moving object on a platform?
« Reply #3 on: June 07, 2014, 05:42:26 PM »
After reading trough answers here's what I'll try: I'll store the vector3 var of the moving platform and translate it to the transform of the rigidbody once it's in the platform.

1982

  • Junior Playmaker
  • **
  • Posts: 71
Re: Moving object on a platform?
« Reply #4 on: June 08, 2014, 05:04:28 AM »
Your parent object Transform needs to be 1,1,1 to avoid squashing.

But yes, vector3 check works also.

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: Moving object on a platform?
« Reply #5 on: June 08, 2014, 05:20:44 AM »
Your parent object Transform needs to be 1,1,1 to avoid squashing.

But yes, vector3 check works also.

After trying several combinations I think parenting is the best solution for a controllable rigidbody. Vector3 anchors the rigidbody and makes it static.

The only thing is to avoid the squashing. I'll try with the 1,1,1 for the parent, but then how can I have more than one platform in the scene, wouldn't they overlap?

1982

  • Junior Playmaker
  • **
  • Posts: 71
Re: Moving object on a platform?
« Reply #6 on: June 08, 2014, 06:06:57 AM »
I guess the level needs to be designed so that the platforms don't overlap. I am not sure what you meant here :)

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: Moving object on a platform?
« Reply #7 on: June 08, 2014, 06:21:05 AM »
I guess the level needs to be designed so that the platforms don't overlap. I am not sure what you meant here :)

I meant that if the parent has to be at 1,1,1 then all the platforms should be at 1,1,1 being the parent. But then I finally got what you said very clearly, it's just me I didn't get it - what I need is a empty object at 1,1,1 which is child to the specific platform, but becomes parent to the object on the platform when it's on it. So I don't need the actual platform to be at 1,1,1.

And it worked. Thank you @Alex, @1982!
I wonder is the 1,1,1 a trick, a workaround, a bug or something deliberate by Unity.

1982

  • Junior Playmaker
  • **
  • Posts: 71
Re: (Solved) Moving object on a platform?
« Reply #8 on: June 08, 2014, 06:27:13 AM »
I am sorry! By 1,1,1 I meant the scale transform only, not the position :)