Announcement

Collapse
No announcement yet.

Physics Constraint Functions not Exposed

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

    [FEATURE REQUEST] Physics Constraint Functions not Exposed

    I just finish do a Physics Based Articulated Vehicle. And come across a few functions not exposed to Visual Scripting for physics constraints. These would be good to be able to modify at runtime. these are

    Linear Position Strength

    Linear Velocity Strength

    Max Linear Force

    Angular Position Strength

    Angular Velocity Strength

    Max Angular Force

    Exposing these would help with making Physics Based Vehicles with Physic Constraints which intern will help make driving simulation games.

    #2
    It looks like those should already be exposed on PhysicsConstraintComponent, e.g. :

    Code:
    UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsConstraint")
    ENGINE_API void	SetLinearDriveParams(float InSpring, float InDamping, float InForceLimit);
    
    UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsConstraint")
    ENGINE_API void	SetAngularDriveParams(float InSpring, float InDamping, float InForceLimit);
    Spring and Damping are for position drive and ForceLimit is for velocity drive.
    Lead Programmer - UE4 Animation/Physics/Audio Team - Epic Games
    Twitter: @EpicJamesG

    Comment


      #3
      I've been trying to use these to make a simple piston, by setting the linear drive velocity target at runtime, but it doesn't seem to work. I'm using a physics constraint between two meshes with physics enabled. I have a button press to call the function on the piston to set the linear velocity target, and I can see at runtime it fires but it doesn't look like it updates the physics constraint component.

      Comment


        #4
        Originally posted by MechanizedIT View Post
        I've been trying to use these to make a simple piston, by setting the linear drive velocity target at runtime, but it doesn't seem to work. I'm using a physics constraint between two meshes with physics enabled. I have a button press to call the function on the piston to set the linear velocity target, and I can see at runtime it fires but it doesn't look like it updates the physics constraint component.
        I'm pretty sure that angular drive target works in real time, use it to steer ski on aerosled. How are you testing it? do you have the same axis set to free/limited? Did you switched on check box of that specific axis in the drive settings?
        Youtube Channel

        Comment


          #5
          I have the z axis set to limited and the limit to distance I want piston to be able to extend, I also have the linear drive velocity on with velocity target for z axis at 100 and damping at 10000. When I set the velocity to -100 before runtime, the piston extends when I play, but when I try to set it at runtime in blueprint, it doesn't work. Not at my computer right now, can post a pic of the blueprint later.

          Comment


            #6
            Yeah, screenshot would help. By what you describe it should work, but devil is in the details.
            Youtube Channel

            Comment


              #7
              Originally posted by MechanizedIT View Post
              I've been trying to use these to make a simple piston, by setting the linear drive velocity target at runtime, but it doesn't seem to work. I'm using a physics constraint between two meshes with physics enabled. I have a button press to call the function on the piston to set the linear velocity target, and I can see at runtime it fires but it doesn't look like it updates the physics constraint component.
              Are you using it as a single function? Those things have to be called every frame, i.e. plugged into the event tick in blue prints.

              Comment


                #8
                Originally posted by BlueBudgie View Post
                Are you using it as a single function? Those things have to be called every frame, i.e. plugged into the event tick in blue prints.
                Now that you've mentioned it, I do call it every tick actually as target is interpolated. But this is a bit weird that you have to update it all the time. Will it get back to default value as soon as you stop setting target?
                Youtube Channel

                Comment


                  #9
                  Ok, so the devil was in the detail, I was setting the wrong axis in 'Set Linear Velocity Target', it is working now.

                  As a note though, it doesn't update unless you also 'Wake Rigid body' after making the change.
                  Click image for larger version

Name:	TogglePiston.PNG
Views:	1
Size:	184.8 KB
ID:	1105924

                  Comment


                    #10
                    Originally posted by MechanizedIT View Post
                    Ok, so the devil was in the detail, I was setting the wrong axis in 'Set Linear Velocity Target', it is working now.

                    As a note though, it doesn't update unless you also 'Wake Rigid body' after making the change.
                    [ATTACH=CONFIG]91925[/ATTACH]
                    Yeah, that thing too. What I usually do is call Wake Rigid Body on player input.

                    Curious how your setup works as I'm planning to add animated engine into the drive train example. The plan was to bake animation in blender or etc. but animating using constrains is an option on the table too.
                    Youtube Channel

                    Comment

                    Working...
                    X