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.

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



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.

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?

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.

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

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?

Ok, so the devil was in the detail, I was setting the wrong axis in ‘Set Linear Velocity Target’, it is working now. :o

As a note though, it doesn’t update unless you also ‘Wake Rigid body’ after making the change.

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.