playMaker

Author Topic: Rigid Body/Add Force Problem  (Read 5734 times)

Micah

  • Playmaker Newbie
  • *
  • Posts: 30
Rigid Body/Add Force Problem
« on: February 19, 2018, 02:06:23 PM »
Hello I'm quite new to all of this, so I'm sorry if this is a silly question.
Basically I am trying to make a cube Jump. I have the cube moving around fine with a Get Axis Vector and Controller Simple Move.
However when trying to make the Cube jump, there is a problem. I have used a new FSM.

I have the Get Key Down State which is connected to Add Force state. No matter What I do, the cube won't jump, instead there is odd behavior, as if it is being buried into the ground. When I use the translate action, the cube blast off into the sky like a cannon ball. If I remove the rigid body, translate works better however, The cube teleports upwards, then falls down. I'm tearing my hair out, trying to figure out what I am missing. I've searched around and tried different things but haven't found a solution. Help would be greatly appreciated.
« Last Edit: February 19, 2018, 02:08:20 PM by Micah »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigid Body/Add Force Problem
« Reply #1 on: February 20, 2018, 02:19:07 AM »
Hi,

 Make sure your cube is slightly above the floor before you start, it could be that it's intersecting the floor and makes it odd.

 Bye,

 Jean

Micah

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Rigid Body/Add Force Problem
« Reply #2 on: February 20, 2018, 06:07:18 PM »
Thanks for the reply! I put the object above the ground and it is still having very similar problems and Add force does nothing

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigid Body/Add Force Problem
« Reply #3 on: February 21, 2018, 01:56:09 AM »
Hi,

 Can you wrapp up the scene you have with the cube, I'll see what's going on and adjust, explain how to fix it.

 Bye,

 Jean

Micah

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Rigid Body/Add Force Problem
« Reply #4 on: February 25, 2018, 05:47:41 PM »
Do I Upload on here? If so, I'm not sure how to or do I have to upload to a website and send the link? Do I E-mail this to you? I'm new to this site too sorry lol


EDIT:
I've just discovered something!!! I've managed to get Add Force to work! However,  in order to get it to work, I have had to get rid of "Controller Simple Move". Is there a reason why this happens? Will I have to just stick with using translate for each direction?
« Last Edit: February 25, 2018, 06:04:29 PM by Micah »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigid Body/Add Force Problem
« Reply #5 on: February 26, 2018, 12:44:20 AM »
Hi,

 yes, ControllerSimpleMove uses Unity CharacterController and it's tricky to add force to it on top. It's a known issue with Unity, unfortunatly, there is not much we can do about this. Eitehr you go with a thirdparty controller which will give you all you need or find a way to work within the restriction of a Unity CharacterController

 Bye,

 Jean

Micah

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Rigid Body/Add Force Problem
« Reply #6 on: February 27, 2018, 05:29:17 PM »
Well so far Translate does not work. I goes all over the place. So I am using set velocity. It is working fine enough for now. There are still three big problems. For some reason an invisible cube appears out of nowhere. I know it is there because I keep colliding with it. My only solution seems to be to start the cube in the air so that the invisible cube is in the air. But for level design this will really be impracticable. any reason why this happens?

Also the Jump function is still wonky. Basically I can jump infinitely. I am trying the Controller is grounded action, put the "True Event" to Finished and connected it back to the first state. Like the post in this thread. http://hutonggames.com/playmakerforum/index.php?topic=12334.msg57556#msg57556

But When doing that, the cube jumps just once and never jumps again.

In addition, when I jump at the wall (which is just a then cube) the cube sticks to the wall and I can jump off it, what options do I have?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigid Body/Add Force Problem
« Reply #7 on: February 28, 2018, 01:05:20 AM »
Hi,

 your character should always starts slightly above the ground, it's a known 'feature' when setting up physics position , else the engine may miss the initial contact.

your character has a boolean flag to check if it's grounded or not. and so you need to

Have you checked the PlayMaker samples? they do feature lots of character setups. I would check them out to see if you can extract hat you need from that.

http://hutonggames.com/tutorials_game_design_with_playmaker.php

Bye,

 Jean

Micah

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Rigid Body/Add Force Problem
« Reply #8 on: March 01, 2018, 06:33:13 PM »
Hello. I have another update which is leading to a dilemma. I have managed to get "controller is Grounded" to work. Because I wasn't sharp enough to realize that the action is CONTROLLER is grounded. So I tested this with the controller and yes it works. Only problem? I'm back to square one. Controller does not work with "Add Force". I was wondering if there is another is grounded function?

xxltnt

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Rigid Body/Add Force Problem
« Reply #9 on: June 25, 2018, 01:00:21 PM »
I'm having the exact same problem.
I found another way of jumping (using the charactermotor script), but that brings up some other problems for me (not being able to move direction while jumping, and bouncing off things).

Anyways, you might wanna give it a shot, it works great with the character controller.
Here is a tut on how to do it:
https://hutonggames.com/playmakerforum/index.php?topic=1951.0

verybinary

  • Junior Playmaker
  • **
  • Posts: 81
    • The Museum of Digital
Re: Rigid Body/Add Force Problem
« Reply #10 on: June 26, 2018, 10:38:49 AM »
I used to have lots of problems with the unity supplied character controllers. this caused an error because of rigidbody, that caused an error because of god knows what else.
I resorted to skipping past all unity controller whatever, and making my own with playmaker. and as a bonus, I now know why something does or doesn't work, or how to change anything easily.
so...
put you a capsule or a 64x128 sprite up there, and make it move with get axis or axis vector, and translate or add force, im pretty sure I use set velocity sometimes, but maybe just with sprites. im not too sure about the specifics but when its set up correctly, its much easier to tweak it to act like you want it to.