Announcement

Collapse
No announcement yet.

Standing on physics objects [4.14]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Standing on physics objects [4.14]

    I'm trying to create a platform which can tilt as players stand on them, however I'm running into trouble immediately as the player stands on the platform.

    Here is a video

    Is it possible to somehow avoid this behavior? The object in the video has both Linear and Angular damping set at 25, if it's set to 0, it's even worse with the platform sometimes just flying off into the distance.

    If I lock X Y Z position, I just fall through it, while it rotates as I push it.
    Last edited by Gmi; 01-25-2017, 03:36 PM.

    #2
    It depends on how you implemented the interaction with the platform. From what I can see, you have probably programmed a platform reaction based on the player hit and that messes up physics if it's not done well.

    Remember that the player is simulated, it doesn't have actual physics, so the interaction with the platform is also simulated.

    The player exerts a force by default when standing on something. Standing Downward Force in Character Movement component.

    It's good to have the damping, but that's not the problem here. Post a blueprint of your player/platform, otherwise we're not gonna be able to help you.

    Comment


      #3
      [MENTION=40304]Andrei Branescu[/MENTION] , thanks for the reply. The reason for why I did not post my blueprints were because there was nothing there. It was simply a platform with physics enabled and location constraints turned on.


      After that post though, tried starting back from scratch. Now I'm using a collision box component rather than the mesh itself for collision and it seems to work a bit better however, it's still a bit unreliable and moves way too fast regardless of how much linear and angular dampening I use.

      I've added some blueprint nodes to try to balance the platform back to rotation 0, 0, 0 once a player steps off. Here are the blueprints I'm currently using:


      Screenshot 1
      - Here's a picture of the collision box settings. I've tried increasing the linear and angular damping here with little effect.


      Screenshot 2
      - Here's the box that checks if a player is overlapping

      Screenshot 3 - Here's the blueprint. Basically I keep checking if a player is overlapping the box from "Screenshot 2", if not, I use a Rinterp to to move the platform to 0,0,0.


      Here's a video. The platform handles much better than in my first post, however it still moves way too fast (I have both angular and linear dampening set to 100 in the video) and it shakes weirdly occasionally.

      I've also tried changing the characters "Standing Downward Force Scale" to 0.2 from 1 with little difference to the speed of the platform tilting.

      Is there any way to get it to move slower as a player steps on it?
      Last edited by Gmi; 01-28-2017, 11:55 AM.

      Comment


        #4
        Originally posted by Gmi View Post
        [MENTION=40304]Andrei Branescu[/MENTION] , thanks for the reply. The reason for why I did not post my blueprints were because there was nothing there. It was simply a platform with physics enabled and location constraints turned on.


        After that post though, tried starting back from scratch. Now I'm using a collision box component rather than the mesh itself for collision and it seems to work a bit better however, it's still a bit unreliable and moves way too fast regardless of how much linear and angular dampening I use.

        I've added some blueprint nodes to try to balance the platform back to rotation 0, 0, 0 once a player steps off. Here are the blueprints I'm currently using:


        Screenshot 1
        - Here's a picture of the collision box settings. I've tried increasing the linear and angular damping here with little effect.


        Screenshot 2
        - Here's the box that checks if a player is overlapping

        Screenshot 3 - Here's the blueprint. Basically I keep checking if a player is overlapping the box from "Screenshot 2", if not, I use a Rinterp to to move the platform to 0,0,0.


        Here's a video. The platform handles much better than in my first post, however it still moves way too fast (I have both angular and linear dampening set to 100 in the video) and it shakes weirdly occasionally.

        I've also tried changing the characters "Standing Downward Force Scale" to 0.2 from 1 with little difference to the speed of the platform tilting.

        Is there any way to get it to move slower as a player steps on it?
        If i have to code these moving platforms, i would use "set rotation" + "rinterp" custom code... I think physics is a bit unreliable, i saw physics behavior used only for cosmetic stuff... but im not expert in coding...
        You can simply do variable behavior of moving platforms by adding collision volume to platform. Then check where is actor relative to its origin, the more far away from origin he is, the faster move platform, depenging on actor relative XY location, rotate it around X and Y... i think with this you can achieve very good results

        edit: now i checked your code and i see you are already doing that.... so imo you can upgrade it with changing variable intepr speed... and dont forget plug delta time from tick node to rinterp node.. variable interp speed change with this: [origin location] - [actor location] drag wire and use node "vector length", you will get float output.. use map range with this float output, for example 0-500 -> 0.1-1 ...
        Last edited by Name368; 01-28-2017, 12:57 PM.

        Comment


          #5
          If you want that kind of interaction, damping and such is not so appropriate.
          You have to use a Physics constraint component.

          Lock the position on all axes and then free the rotation on all axes.
          To limit the rotation, you can use the Angular motor. Target Orientation tries to keep the object ata certain rotation using forces. Target velocity, tries to keep it moving at a certain velocity (this is damping the movement if it's moving too fast).

          Here, I implemented a seesaw:

          Click image for larger version

Name:	Seesaw1.png
Views:	1
Size:	208.2 KB
ID:	1122925
          Click image for larger version

Name:	Seesaw2.png
Views:	1
Size:	321.7 KB
ID:	1122926
          Click image for larger version

Name:	Seesaw3.png
Views:	1
Size:	320.7 KB
ID:	1122927

          Hope this helps.

          Comment

          Working...
          X