playMaker

Author Topic: How to make player be able to push objects?  (Read 3532 times)

Roninfang

  • Playmaker Newbie
  • *
  • Posts: 32
How to make player be able to push objects?
« on: August 03, 2015, 05:51:14 AM »
How to make player be able to push objects?

got the basic controls working...but now i want the player be able to push objects/rigid bodies etc

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to make player be able to push objects?
« Reply #1 on: August 03, 2015, 01:40:52 PM »
Hi,
there are different ways to do this 1 for example you make the mass from the player bigger than the mass from the objects to push

or

you can use a trigger and set the item as child when triggered, but that might need some more actions, like for example to detach child when player moving to the other side

it depends on your project

Roninfang

  • Playmaker Newbie
  • *
  • Posts: 32
Re: How to make player be able to push objects?
« Reply #2 on: August 03, 2015, 02:03:03 PM »
ill try the child method...

hmmm can you guide me or give me a basic idea how to go about it?

Roninfang

  • Playmaker Newbie
  • *
  • Posts: 32
Re: How to make player be able to push objects?
« Reply #3 on: August 03, 2015, 02:12:18 PM »
hmmm maybe something like this?

when character touches object its suppose to push like a crate or something

use the Addforce fsm?

http://www.hutonggames.com/sampleScenes/AddForce/AddForce.html

in anycase currently trying to make a platformer...what i have set right now is when i press a character moves to the left, when i press d character moves to the right

what i want to happen is example theres a crate beside character on its right...when it touches the crate and moves to the right, it will push the crate

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to make player be able to push objects?
« Reply #4 on: August 03, 2015, 06:41:24 PM »
Hi,
if you have a ridgidbody on both (player and crate)
you should be able to push by walking against it

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: How to make player be able to push objects?
« Reply #5 on: August 03, 2015, 08:19:31 PM »
you can use a trigger and set the item as child when triggered, but that might need some more actions, like for example to detach child when player moving to the other side

it depends on your project

Setting the adding more mass to the player aside, I did have a previous project around where I did have a problem making a non parented object become a child.

What other methods to deal with that problem would come to your mind?

Roninfang

  • Playmaker Newbie
  • *
  • Posts: 32
Re: How to make player be able to push objects?
« Reply #6 on: August 03, 2015, 10:56:30 PM »
"if you have a ridgidbody on both (player and crate)"

thats what i did but doesnt seeem to be working so going to try another method hmmm

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to make player be able to push objects?
« Reply #7 on: August 04, 2015, 06:27:48 AM »
Hi,
Are you using 2d or 3d?

I have not tested on 2d yet, but will test that today

on 3d that should work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to make player be able to push objects?
« Reply #8 on: August 04, 2015, 06:40:25 AM »
Hi,
just tested it and should work on both 2d and 3d,

do you also have colliders on both?

Roninfang

  • Playmaker Newbie
  • *
  • Posts: 32
Re: How to make player be able to push objects?
« Reply #9 on: August 04, 2015, 09:34:56 AM »
ic ....i forgot to add the collider i think thats what i missed out >_<